加载字库图片 - InitDictFromDir
函数简介
从指定目录中加载字库图片文件,并将其初始化到OLA数据库中。
接口名称
InitDictFromDir
DLL调用
int InitDictFromDir(long ola, long db, string dict_name, string dict_path, int cover);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| db | 长整数型 | 数据库连接句柄,由 OpenDatabase 接口生成。 |
| dict_name | 字符串 | 字库名称 |
| dict_path | 字符串 | 字库图片文件夹路径 |
| cover | 整数型 | 是否覆盖已存在的图像数据,1 覆盖,0 跳过 |
示例
C++
long instance = CreateCOLAPlugInterFace();
long db = OpenDatabase(instance, "dict.db");
// 从目录加载字库图片到数据库,覆盖已有数据
int ret = InitDictFromDir(instance, db, "mydict", "C:\\dicts\\images", 1);
Python
# 待补充
返回值
1 成功,0 失败。
注意事项
- 适用于批量导入字库图片的场景
cover设置为 1 时会覆盖现有数据,设置为 0 时会跳过已存在的图像- 如果初始化失败,可以通过 GetDatabaseError 函数获取详细的错误信息
- 确保目录路径正确,且图像文件格式受支持
