二维码生成库的使用注意事项 libqrencode

cmake 修改

option(WITH_TOOLS "Build utility tools" YES )
option(WITH_TESTS "Build tests" NO )
option(WITHOUT_PNG "Disable PNG support" YES) #1.屏蔽PNG
option(GPROF "Generate extra code to write profile information" OFF)
option(COVERAGE "Generate extra code to write coverage information" OFF)
option(ASAN "Use AddressSanitizer" OFF)
option(BUILD_SHARED_LIBS "Enable build of shared libraries" YES)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") #2.动态库

qrencode 的数据结构 QRcode->data的最后一个bit表示的才是数据,不能直接使用if(QRcode->data)

Copy
/** * QRcode class. * Symbol data is represented as an array contains width*width uchars. * Each uchar represents a module (dot). If the less significant bit of * the uchar is 1, the corresponding module is black. The other bits are * meaningless for usual applications, but here its specification is described. * * @verbatim MSB 76543210 LSB |||||||`- 1=black/0=white ||||||`-- 1=ecc/0=data code area |||||`--- format information ||||`---- version information |||`----- timing pattern ||`------ alignment pattern |`------- finder pattern and separator `-------- non-data modules (format, timing, etc.) @endverbatim */ typedef struct { int version; ///< version of the symbol int width; ///< width of the symbol unsigned char *data; ///< symbol data } QRcode;

具体代码见gitee https://gitee.com/layty/libqrencode/blob/master/demo1.c 查看git log

posted @   zongzi10010  阅读(331)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 【杂谈】分布式事务——高大上的无用知识?
历史上的今天:
2019-10-09 sqlite3数据库修复SQLite-database disk image is malformed
点击右上角即可分享
微信分享提示