Archived

This topic is now archived and is closed to further replies.

BeerNutts

Other picture file formats in Ddraw...

Recommended Posts

Guys, I didn''t see anything posted about this, but I''m sure it''s an easy question. Is there an easy way to use other picture formats (jpg, gif, etc.) besides .bmp''s to use as surfaces? The size of the .bmp''s in Bytes are enormous, and I''d rather use compressed pictues, then decompress them before putting them in a surface. Thanks, BeerNutts

Share this post


Link to post
Share on other sites
If you want to use compressed images for your games, I''d recommend PNGs. THere''s a free, multiplatform library out there called libPNG that will help out with the loading. Stay away from GIF files (legal issues).

If you want to support several formats, FreeImage (http://www.6ixsoft.com/) supports loading/saving of quite a few formats.

I suggest you avoid using standard image formats in your games and create your own. It''s not difficult, and the experience is invaluable. A basic file format could consist of something like:

ID - a character string denoting the file extension
version - version of the format (1.0, 1.1, 2.0, etc...)
BPP - color depth of the image
Width
Height
ImageData - actual pixel values

Once you decide on a format, you should create a converter. Use FreeImage to load various formats, extract the info you need for your format (bpp, width, height, and image data), than you could use JCalg1 or ZLib to compress it all, and finally write it to disk.

Share this post


Link to post
Share on other sites