------------------
Dance with me......
Accessing bitmap data
You should use three chars.....one for each color value.
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
Thanks
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?
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
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......
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement