裁剪图片 - Cropped
函数简介
裁剪图片,图片大小为 x2-x1, y2-y1。
接口名称
Cropped
DLL调用
long Cropped(long ola, long image, int x1, int y1, int x2, int y2);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| image | 长整数型 | OLAImage对象的地址 |
| x1 | 整数型 | 区域的左上角X坐标 |
| y1 | 整数型 | 区域的左上角Y坐标 |
| x2 | 整数型 | 区域的右下角X坐标 |
| y2 | 整数型 | 区域的右下角Y坐标 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// hwnd 为绑定的窗口句柄
long img = GetScreenDataPtr(instance, 0, 0, 0, 0);
// 裁剪出(10,10)-(200,200)区域的图片
long croppedImg = Cropped(instance, img, 10, 10, 200, 200);
if (croppedImg != 0) {
// 使用裁剪后的图片...
FreeImagePtr(instance, croppedImg);
}
FreeImagePtr(instance, img);
Python
# 待补充
返回值
长整数型:返回裁剪后的图像指针,失败返回0。
注意事项
- 返回的图片需调用 FreeImagePtr 释放内存。
