Add Tga file support (#25)

* Add minimal tga image loader

* Update TGA class ,add support for importing tga texture files and generate mipmap from tga images

* Add copyright and resource links

* Partial Add SaveImage

* Move TGAReader/Writer outside of TGA.cs

* Add check to return early when `DataTypeCode` is set to NO_DATA

* Add support for loading ExtensionData

* Change PNG signature check more clear

* Remove unnecessary using statements

* Move Debug stuff into Debug methods and call LoadImage before LoadFooter

* Update TGAReader

* Update TGA Reader/Writer

* Remove TGATimeSpan and use TimeSpan and DateTime instead

* Update TGAHeader member varible name and type

* Update TGA- Reader/Writer Constructor to not accept boolean flag 'useLittleEndian'

* TGAReader - Optimized 'TGA_HandleRGB'

* TGAReader - Update and rename 'TGA_HandleRLE_RGB'

* TGAWriter - Remove RLE RGB from switch statement

* TGA - Add TGA.FromFile, Move TGADataTypeCode to its own file

* Move Header, Footer and ExtentionData to there own cs file

* Move Tga files into IO folder

* Changed visibility of tga related classes to internal

* TGA - Only support reading/writting of raw RGB 32 bit images

* Update IO/TGA classes
This commit is contained in:
Miku-666
2024-03-24 14:48:49 +01:00
committed by GitHub
parent 3cb6097d14
commit f645914ee6
13 changed files with 721 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ using System.Text;
using System.Threading.Tasks;
using OMI.Formats.Pck;
using OMI.Workers;
using PckStudio.IO.TGA;
namespace PckStudio.Extensions
{
@@ -30,7 +31,10 @@ namespace PckStudio.Extensions
{
try
{
return Image.FromStream(stream);
if (Path.GetExtension(file.Filename) == ".tga")
return TGADeserializer.DeserializeFromStream(stream);
else
return Image.FromStream(stream);
}
catch(Exception ex)
{