二維碼生成庫的使用注意事項 libqrencode
阿新 • • 發佈:2020-10-09
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)
/** * 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