Archived

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

Accessing bitmap data

This topic is 6586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I should use an array of chars 3 times bigger than the number of pixels I have? And then, I will look at the next 3 chars in the array, and compare them to the color values in the color I'm looking for?
Thanks

Share this post


Link to post
Share on other sites
Hmmm, well...since you have a pointer to the bitmap data which is 8 bit, you can probably just go about using that pointer for each color value.

Or do something like

unsigned char *BMPData; // point this data to the bmp data you've got

unsigned char b = BMPData[0];
unsigned char g = BMPData[1];
unsigned char r = BMPData[2];

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

Share this post


Link to post
Share on other sites
I am writing a sprite compiler for a pac man clone. I am loading the bitmap file into the compiler using the windows LoadImage function, and so I load the bitmap into a BITMAP struct object. My bitmap files are 24 bit, and the BITMAP includes a pointer to that data that is just 8 bits. How should I go about accessing the data in RGB form? I have tried this:
long* bmBits = (long*)bitmap.bmBits;
but the thing doesn't seem to work, and I'm pretty sure that's where the problem is. Could it have something to do with the fact that a long is 32 bits and my image data is only 24 bits?

Any help is appreciated,
Jonathan Little

------------------
http://qoy.tripod.com

Share this post


Link to post
Share on other sites