ZXing-C++ ("zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library implemented in C++.
It was originally ported from the Java ZXing Library but has been developed further and now includes many improvements in terms of quality and performance. It can both read and write barcodes in a number of formats.
Features
In pure C++17, no third-party dependencies
Stateless, thread-safe readers/scanners and writers/generators
Create a MultiFormatWriter instance with the format you want to generate. Set encoding and margins if needed.
Call encode() with text content and the image size. This returns a BitMatrix which is a binary image of the barcode where true == visual black and false == visual white.
Convert the bit matrix to your native image format. See also the ToMatrix<T>(BitMatrix&) helper function.
In an empty build folder, invoke emcmake cmake <path to zxing-cpp.git/wrappers/wasm>.
Invoke cmake --build . to create zxing.js and zxing.wasm (and _reader/_writer versions).
To see how to include these into a working HTML page, have a look at the reader and writer demos.
To quickly test your build, copy those demo files into your build directory and run e.g. emrun --serve_after_close demo_reader.html.
You can also download the latest build output from the continuous integration system from the Actions tab. Look for 'wasm-artifacts'. Also check out the live demos.
请发表评论