View Single Post
  #4  
Unread 12-23-2008, 06:07 AM
Tiaga Tiaga is offline
The Wary
 
Join Date: Dec 2008
Posts: 1
Just a little tip on TGA files and C#...

The TGA format is a very simple graphics format. In some incarnations, the blob of graphics data may even be binary compatible with a bmp file (With differences in the header only).

The quick and dirty way to read a tga in would be to read the file yourself (Do a search for tga file format, it's all over the place) and lock the bits in a Bitmap object to get at the image data, copying it in.

While this works, it can be a bit slow to lock and unlock the image data for access. A quicker way (Graphics load time-wise anyway) would be to derive a class from Stream and put in there code to translate the header (And if necessary data) from TGA to BMP, then pass the that stream to the Bitmap class to load the image data. The Bitmap object will then happily read in the faked translation layer much quicker than trying to manually load the image in.
Reply With Quote