HGE Hardware color format
Several HGE functions use color as a parameter or return value.
It is just a DWORD, containing four 8-bit values for Red, Green, Blue and Alpha
color components in the following way: 0xAARRGGBB.
I.e. the highest BYTE of DWORD contains the Alpha value.
The next BYTE contains the Red value. Then goes Green value.
And the lowest BYTE contains Blue value.
Macros
You could use these macros to manipulate DWORD color values:
ARGB(a,r,g,b)
((DWORD(a)<<24) + (DWORD(r)<<16) + (DWORD(g)<<8) + DWORD(b))
ARGB macro builds a DWORD color value from it's components.
GETA(col) ((col)>>24)
GETR(col) (((col)>>16) & 0xFF)
GETG(col) (((col)>>8) & 0xFF)
GETB(col) ((col) & 0xFF)
GETA, GETR, GETG and GETB macros return the specified component of the composite DWORD.
SETA(col,a) (((col) & 0x00FFFFFF) + (DWORD(a)<<24))
SETR(col,r) (((col) & 0xFF00FFFF) + (DWORD(r)<<16))
SETG(col,g) (((col) & 0xFFFF00FF) + (DWORD(g)<<8))
SETB(col,b) (((col) & 0xFFFFFF00) + DWORD(b))
SETA, SETR, SETG and SETB macros change the specified component of the composite DWORD.
Requirements
Header: hge.h
See also
hgeColor helper class
|