对比颜色 - CmpColorPtr
函数简介
对比图片指定坐标的颜色是否在指定的颜色范围区间内,包含下限(>= color1) 包含上限(<= color2)。
接口名称
CmpColorPtr
DLL调用
int CmpColorPtr(long ola, long img, int x, int y, string color1, string color2);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| img | 长整数型 | OLAImage对象的地址 |
| x | 整数型 | 要对比颜色的X坐标 |
| y | 整数型 | 要对比颜色的Y坐标 |
| color1 | 字符串 | 颜色起始范围,格式 RRGGBB 或 AARRGGBB |
| color2 | 字符串 | 颜色结束范围,格式 RRGGBB 或 AARRGGBB |
示例
C++
long instance = CreateCOLAPlugInterFace();
// hwnd 为绑定的窗口句柄
long img = GetScreenDataPtr(instance, 0, 0, 0, 0);
// 判断图片中坐标(50,50)的颜色是否在指定范围内
int ret = CmpColorPtr(instance, img, 50, 50, "00FF00", "55FF55");
if (ret == 1) {
printf("颜色匹配成功\n");
}
FreeImagePtr(instance, img);
Python
# 待补充
返回值
整数型:1 成功,0 失败。
