C++中RGB转换为ARGB
2015-06-18 11:32
316 查看
RGB :是24位的颜色值,高八位为R,中间八位为G,后八位为B。
ARGB:是32位的颜色值。高八位为A,次八位为R,再次八位为G,最后八位为B。
转换使用如下方法,我是先调颜色对话框取色,然后转化:
COLORREF col;
CColorDialog colorDialog;
if (IDOK == colorDialog.DoModal())
{
col= colorDialog.GetColor();
}
//转化
UINT r,g,b ;
r = GetRValue(col);
g = GetGValue(col);
b = GetBValue(col);
UINT argb = (0xFF << 24) | (r << 16) | (g << 8) | b;
ARGB:是32位的颜色值。高八位为A,次八位为R,再次八位为G,最后八位为B。
转换使用如下方法,我是先调颜色对话框取色,然后转化:
COLORREF col;
CColorDialog colorDialog;
if (IDOK == colorDialog.DoModal())
{
col= colorDialog.GetColor();
}
//转化
UINT r,g,b ;
r = GetRValue(col);
g = GetGValue(col);
b = GetBValue(col);
UINT argb = (0xFF << 24) | (r << 16) | (g << 8) | b;
相关文章推荐
- c++ 中 struct 和 class 的区别
- C++运算符重载为成员函数
- C++中++运算符的重载
- C++运算符重载为非成员函数
- VC++动态链接库(DLL)编程深入浅出
- C语言-srand种子详解
- C++namespace命名空间
- C++ 12.1.5 定义类对象
- Effective C++ 条款54-55
- C++中赋值操作符为什么要返回引用类型
- C++实现设计模式 - STATE(状态)—对象行为模式(第二十个)
- 画数组的直方图
- C++12.1.4 类的前向声明、不完全类型类
- 作用域内枚举(C++11)
- POJ 1338 Ugly Numbers
- C语言易混淆关键词详解-const,static,extern,typedef,声明
- c++ builder 俩种不同风格的窗体
- std::string字符串分割
- C语言中##和#argument预处理运算符
- 浅谈C++多态性