和BMP也无关拉,只是调用GDI如果是24位的位图,从内存中取出来是按BGR排列的TColor是直接用数字表示的,可不是记录类型,而且任何时候都不包括Alpha通道If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color intensities for blue, green, and red, respectively. The value $00FF0000 represents full-intensity, pure blue, $0000FF00 is pure green, and $000000FF is pure red. $00000000 is black and $00FFFFFF is white.If the highest-order byte is zero ($00), the color obtained is the closest matching color in the system palette. If the highest-order byte is one ($01), the color obtained is the closest matching color in the currently realized palette. If the highest-order byte is two ($02), the value is matched with the nearest color in the logical palette of the current device context.
和BMP也无关拉,只是调用GDI
你可以不必管他们存储的格式,用这四个Macro就可以了:由RGB分量构成颜色值: COLORREF RGB( BYTE bRed, // red component of color BYTE bGreen, // green component of color BYTE bBlue // blue component of color );分离各个分量: BYTE GetBValue( WORD rgb // 32-bit RGB value ); BYTE GetGValue( WORD rgb // 32-bit RGB value ); BYTE GetRValue( WORD rgb // 32-bit RGB value );
r:Byte;
g:Byte;
b:Byte;
Alpha:Byte;
end;但在使用时要注意,如果你用
myColor:=$AABBCC00来赋值的话,那么你得到的myColor其实相当于RGB($00,$CC,$BB)(在不考虑Alpha通道的情况下),这是因为在Delphi里保存数据是低位占第一位的,也就是说,
const i:integer=1在内存中的形式是01 00 00 00,而不是00 00 00 01.
COLORREF RGB(
BYTE bRed, // red component of color
BYTE bGreen, // green component of color
BYTE bBlue // blue component of color
);分离各个分量:
BYTE GetBValue(
WORD rgb // 32-bit RGB value
);
BYTE GetGValue(
WORD rgb // 32-bit RGB value
);
BYTE GetRValue(
WORD rgb // 32-bit RGB value
);