生成二维码 - CreateQRCodeEx
函数简介
根据字符串数据生成二维码图片,支持自定义版本、容错等级和编码模式。
接口名称
CreateQRCodeEx
DLL调用
long CreateQRCodeEx(long ola, string str, int pixelsPerModule, int version, int correctionLevel, int mode, int structureNumber);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| str | 字符串 | 生成二维码的字符串数据 |
| pixelsPerModule | 整数型 | 每个数据像素大小 |
| version | 整数型 | 二维码版本 |
| correctionLevel | 整数型 | 容错等级:0 CORRECT_LEVEL_L、1 CORRECT_LEVEL_M、2 CORRECT_LEVEL_Q、3 CORRECT_LEVEL_H |
| mode | 整数型 | 字节编码模式:-1 AUTO、1 NUMERIC、2 ALPHANUMERIC、4 BYTE、7 ECI、8 KANJI、3 STRUCTURED_APPEND |
| structureNumber | 整数型 | 结构化追加的首个码索引 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 生成二维码:每模块10像素,版本0自动,容错H级,自动编码
long img = CreateQRCodeEx(instance, "https://example.com", 10, 0, 3, -1, 0);
if (img != 0) {
// 使用二维码图片...
FreeImagePtr(instance, img);
}
Python
# 待补充
返回值
长整数型:返回OLAImage对象的地址,失败返回0。
注意事项
- 返回的图片需调用 FreeImagePtr 释放内存。
