🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

GetBitmapBits

Started by
14 comments, last by GameDev.net 24 years, 7 months ago
Felisandria, thank you, but that stuff didn't really help. A) it was MFC, and i don't use that *COUGH*crap*COUGH* ;-) and B) it was all about just writing the bits, but didnt show how to necesarily get them. and CJ, nope, never got that stuff.
Advertisement
Ok, i devised a method of doing it, where i simply take the colors from each pixel and just write that to the file. But the problem is, the bmp file was 29.4 kb and the new file is 290 kb!!! This is absurd, I just want to be able to write the bits to a file...
Could you possibly be taking an 8-bit or similar lookup-table style file, and be converting it to a 24 or 32 bit full-RGB file?

By the way, MFC is an extremely thin layer over the GDI in the bitmap handling functions, so all you would have to do is find the corresponding GDI functions to get it out of MFC (for future reference)

-fel

~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
You should have them now, and if it went wrong again, I will post the code here

------------------
Dance with me......

I'm writing this program that loads 3d files and displays them. So now I'm trying to load textures too. So I can load it and display it and stuff. I have an HBITMAP structure loaded and crap from LoadImage. I want to write all the data of the bitmap to the file. I figure I can use GetBitmapBits and then write all the bits and then create a bitmap with those values. How would I do this? As in, what code would be necessary to use GetBitmapBits from an HBITMAP and then create one from all those bits?
BMP is usually run-length compressed, writing out what was previously a compressed bitmap as a raw file WILL result in a larger file.

Is the bitmap you write out correct? (I.e. did you test to see if the data it contains are correct?), if not, chances are that the big file size was caused by a buggy image write function.

There are PLENTY of resources on fileformats such as BMP, TGA and JPEG on the net (altavista gives 3 correct links on the first page if you search "TGA format") - If you don't like MFC and GDI (and I can't blame you) write your own based on the format spec - it's a 20 minute job.

/Niels

<b>/NJ</b>

This topic is closed to new replies.

Advertisement