soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SDIBHelper.h
1#ifndef __SDIBHELPER__H__
2#define __SDIBHELPER__H__
3
4#include "interface/SRender-i.h"
5
6SNSBEGIN
7
8/**
9 * @class SDIBHelper
10 * @brief 提供对位图进行颜色处理的辅助类
11 * @details 简洁版本,简版去掉了对8、16、24位的支持
12 */
13class SOUI_EXP SDIBHelper {
14 public:
15 /**
16 * @brief 对位图进行着色处理
17 * @param pBmp 位图对象指针
18 * @param crRef 目标颜色
19 * @return 成功返回TRUE,失败返回FALSE
20 */
21 static bool Colorize(IBitmapS *pBmp, COLORREF crRef);
22
23 /**
24 * @brief 对单个颜色进行着色处理
25 * @param crTarget 目标颜色引用
26 * @param crRef 参考颜色
27 * @return 成功返回TRUE,失败返回FALSE
28 */
29 static bool Colorize(COLORREF &crTarget, COLORREF crRef);
30
31 /**
32 * @brief 将位图转换为灰度图像
33 * @param pBmp 位图对象指针
34 * @return 成功返回TRUE,失败返回FALSE
35 */
36 static bool GrayImage(IBitmapS *pBmp);
37
38 /**
39 * @brief 计算图片的平均颜色
40 * @param pBmp 图片源位图对象指针
41 * @param nPercent 有效值百分比,90代表最高和最低5%的值会丢掉,不参与平均
42 * @param nBlockSize 分块大小,每次计算一个块的颜色平均值
43 * @return 计算得到的平均颜色
44 */
45 static COLORREF CalcAvarageColor(IBitmapS *pBmp, int nPercent = 90, int nBlockSize = 5);
46};
47
48SNSEND
49#endif // __SDIBHELPER__H__
提供对位图进行颜色处理的辅助类
Definition SDIBHelper.h:13
static bool GrayImage(IBitmapS *pBmp)
将位图转换为灰度图像
static bool Colorize(IBitmapS *pBmp, COLORREF crRef)
对位图进行着色处理
static COLORREF CalcAvarageColor(IBitmapS *pBmp, int nPercent=90, int nBlockSize=5)
计算图片的平均颜色
Bitmap object interface.
Definition SRender-i.h:420