xxxxxxxxxx
import std.stdio;
alias uint COLORREF;
struct Color
{
union
{
COLORREF native;
struct
{
ubyte r;
ubyte g;
ubyte b;
}
}
ubyte a = 0xFF;
}
Color argb( uint color )
{
Color c;
c.native =
cast( uint ) (
( ( color & 0x000000FF ) << 16 ) |
( ( color & 0x0000FF00 ) ) |
( ( color & 0x00FF0000 ) >> 16 )
);
c.a = ( color & 0xFF000000 ) >> 24;
return c;
}
Color rgb( uint color )
{
return
Color( cast( uint ) (
( ( color & 0x000000FF ) << 16 ) |
( ( color & 0x0000FF00 ) ) |
( ( color & 0x00FF0000 ) >> 16 )
) );
}
void main() {
auto color = 0x00AABBCC.argb;
auto color2 = 0x00AABBCC.rgb;
}