读取图片PNG字节流 - GetImagePngData
函数简介
获取指定图像,用PNG数据格式返回。
接口名称
GetImagePngData
DLL调用
int GetImagePngData(long ola, long ptr, long* data, int* size);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| ptr | 长整数型 | OLAImage对象的地址 |
| data | 长整数型指针 | 返回图片的数据指针 |
| size | 整数型指针 | 返回图片的数据长度 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// hwnd 为绑定的窗口句柄
long img = GetScreenDataPtr(instance, 0, 0, 0, 0);
long data = 0;
int size = 0;
int ret = GetImagePngData(instance, img, &data, &size);
if (ret == 1) {
printf("PNG数据大小: %d\n", size);
// 使用data指针读取PNG数据...
FreeImageData(instance, data);
}
FreeImagePtr(instance, img);
Python
# 待补充
返回值
整数型:1 成功,0 失败。
注意事项
- 使用完成需调用 FreeImageData 接口释放内存。
