Board index » cppbuilder » reading in a bitmap to get RGB values

reading in a bitmap to get RGB values

I can't seem to get the rgd values of the pixels. I read in the bitmap
and can read each character in order to write them out to another
bitmap. But when I dump the character to cout it comes out as a zero. So
I tried using byte, or word and still all I get are zeros. I just want
to be able to add up the colors used  in a bitmap by looking at each
pixel. Thanks

Bill

 

Re:reading in a bitmap to get RGB values


Hi Bill,

Quote
> I can't seem to get the rgd values of the pixels. I read in the bitmap
> and can read each character in order to write them out to another
> bitmap. But when I dump the character to cout it comes out as a zero. So
> I tried using byte, or word and still all I get are zeros. I just want
> to be able to add up the colors used  in a bitmap by looking at each
> pixel. Thanks

Have a look at the GetRValue(), GetGValue(), and GetBValue() API
macros.  These should do what you want.  You'll want to convert your
pixel value to a COLORREF before using these macros.  Good luck.

->Damon
-------------------------------------
http://bcbcaq.freeservers.com
Answers to <Commonly Asked Questions>

Other Threads