The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Farabi on July 14, 2009, 03:32:30 AM

Title: TGA File loader
Post by: Farabi on July 14, 2009, 03:32:30 AM
Is MASM or any others assembler had a tga file loader?
Title: Re: TGA File loader
Post by: donkey on July 14, 2009, 04:29:01 AM
I believe GDIPlus handles Targa graphics files (TGA).
Title: Re: TGA File loader
Post by: MichaelW on July 14, 2009, 06:33:20 AM
AFAIK the GDI+ image encoders are:
image/bmp
image/jpeg
image/gif
image/tiff
image/png
Title: Re: TGA File loader
Post by: Farabi on July 14, 2009, 07:37:28 AM
It seems I need to made my own tga loader.
Title: Re: TGA File loader
Post by: Siekmanski on July 14, 2009, 02:55:09 PM
Hi Farabi

You can use the "Display TGA" routine from the OGL examples of Franck Charlet ( hitchhikr )

http://www.masm32.com/board/index.php?topic=2522.0

greetz Siekmanski
Title: Re: TGA File loader
Post by: donkey on July 14, 2009, 03:23:12 PM
Don't know where I got the idea that GDI plus handled it, maybe just assumed that because its such an old format that it would be supported, but yeah, TGA images are extremely simple though they can be RLE encoded generally they are stored without any compression like a bitmap, the header is simple to read:

http://www.ludorg.net/amnesia/TGA_File_Format_Spec.html
Title: Re: TGA File loader
Post by: Farabi on July 14, 2009, 03:47:43 PM
Quote from: donkey on July 14, 2009, 03:23:12 PM
Don't know where I got the idea that GDI plus handled it, maybe just assumed that because its such an old format that it would be supported, but yeah, TGA images are extremely simple though they can be RLL encoded generally they are stored without any compression like a bitmap, the header is simple to read:

http://www.ludorg.net/amnesia/TGA_File_Format_Spec.html
Not really donkey, the TGA file I used is a compressed one. It auto generated by blender.
Title: Re: TGA File loader
Post by: Farabi on July 14, 2009, 03:49:38 PM
Quote from: Siekmanski on July 14, 2009, 02:55:09 PM
Hi Farabi

You can use the "Display TGA" routine from the OGL examples of Franck Charlet ( hitchhikr )

http://www.masm32.com/board/index.php?topic=2522.0

greetz Siekmanski

Im gonna take a look. It's save my time from reinventing the wheel.
Title: Re: TGA File loader
Post by: donkey on July 14, 2009, 04:53:50 PM
Hi Farabi,

if its compressed then it uses RLE compression, that's an extremely simple compression scheme...

[npix][value][npix][value]...

so for example if you have 100 black pixels on a scan line foillowed by 80 white pixels:

[100][0][80][255]

Not sure how simpler it can get than RLE.