Archived

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

KwamiMatrix

Loading .bmp files

Recommended Posts

What up everyone. I am having some trouble loading in .bmp files, and wondering if I could obtain some help. I am using a type ''ifstream'' from fstream.h to load in bitmap data, but I am getting an error stating that the ''>>'' operator is not overloaded to handle windows .bmp files. does anyone know of any alternative ways for reading in bitmaps? I would like to learn new ways for reading in files. thanks Edem Attiogbe

Share this post


Link to post
Share on other sites
I created an image loader class which does the following:

1) load 8 and 24 bits BMP''s (8 bits images are converted to 24 bits)

2) load 8, 24 and 32 bits targa''s (8 bits as a grayscale image)

3) load 24 bits JPEG''s (using Intel JPEG library)

4) load 8 and 24 bits PCX files (8 is automaticly converted to 24 bits).


I created this class to upload textures to OpenGL, but it can be used for allmost everything I guess. If you''re interested post your e-mail adress and I''ll send it to you as soon as I''ve translated the whole thing to english :-)

Share this post


Link to post
Share on other sites
Thanks a whole bunch sysmark. Actually, I think I am in the process of figuring out exactly how I want to load in my bitmaps using the CreateFile and ReadFile Win 32 functions. I would still like to see the work that you did. my email address is:

Kattiogbe@aol.com

once again, thanks a lot for your help. I really appriciate it.

Edem Attiogbe

Share this post


Link to post
Share on other sites
I forgot to ask you something sysmark. Can you go into a little more debt on PCX files please? I have hear of them, but have never used them before. Thanks

Edem Attiogbe

Share this post


Link to post
Share on other sites
.PCX files are just compressed bitmaps. The 8 bit loader I wrote myself, the 24 bits loader I wrote using a code that Telemachos from Peroxide sent me (when I was still coding SVGA Dos games using VESA :-) The compression used is RLE (Run Length Encoding). That means that if you have a runlength of the same values it''s packed into two. For an 8 bits image that would look like this:

uncompressed: 58 58 58 58 58
compressed: 5 58

A 24 bits image is a little harder to decompress, because it works with color layers. This means that each line in the file is first stored like this:

RRRRRRRRGGGGGGGGBBBBBBBBB

and is then run-length encoded in the same way as an 8 bits image. I''ll send the loader to you as soon as I''ve translated all the comments from dutch to english.

Share this post


Link to post
Share on other sites