Hi there
I want to know what is this 开发者_JAVA技巧rgbReserved
in RGBQuadArray
and why when I change RGB colors there are some ugly lines displayed on the image? Is it related to rgbReserved
?
In memory, a line of a bitmap is often stored in the format BBGGRR00BBGGRR00BBGGRR00... so that each pixel will occupy exactly four bytes, or 32 bits. This simplifies a lot of things, and can speed up computations and image manipulation. But if the bitmap specifies the red, green, and blue intensities as bytes (in the range 0..255), and doesn't contain an alpha channel, then each pixel will only need three bytes. So there is a forth unused byte per pixel. And in the pixel structure it's got to be named something. Given that the usable members are called rgbRed
, rgbGreen
, and rgbBlue
, rgbReserved
feels rather OK. Maybe rgbUnused
would be even more suitable, but there is a tradition in Win32 to name (currently) unused parameters "Reserved", as in "reserved for future use". In fact, if you app works with transparent bitmaps containing an alpha channel, each pixel might be of the form BBGGRRAA, so you could use the rgbReserved
as rgbAlpha
.
The latter part of your question cannot be answered as it stands. I have no idea why your code doesn't work. Maybe the pixel intensities are overflowing? Maybe there is some silly bug somewhere?
As a final note: If you wonder what a member of a Win32 structure is, you can always consult the official documentation.
精彩评论