0xffff0000表红色,意思是:
A:ff=255
R:ff=255
G:00=0
B:00=0
可如下将(255,0,0,255)转成0xffff0000并输出:
inline DWORD RGBAToHexARGB(unsigned char r,unsigned char g,unsigned char b,unsigned char a){
DWORD rs=(r<<16)|(g<<8)|b|(a<<24);
return rs;
}
DWORD color=RGBAToHexARGB(r,g,b,a);
cout<<"0x"<<hex<<(int)color<<endl;
参考:
http://zhidao.baidu.com/link?url=66G_pYDi1LV-EXZ-NhLL1q8RPwGYqclK-3pk0k-PcctIA5WuMZZhDXqdFVXUCSIfQWpudtGZ81C__d15Xdj4ra
http://www.cnblogs.com/Billy-rao/p/3944232.html