You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZXing-C++ ("zebra crossing") is an open-source, multi-format linear/matrix barcode image processing library implemented in C++.
6
6
7
-
It was originally ported from the Java [ZXing Library](https://github.com/zxing/zxing) but has been developed further and now includes many improvements in terms of runtime and detection performance. It can both read and write barcodes in a number of formats.
8
-
9
-
## Sponsors
10
-
11
-
You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/axxel).
12
-
13
-
Named Sponsors:
14
-
*[Liftric GmbH](https://github.com/Liftric)
15
-
*[KURZ Digital Solutions GmbH & Co. KG](https://github.com/kurzdigital)
It was originally ported from the Java [ZXing library](https://github.com/zxing/zxing) but has been developed further and now includes many improvements in terms of runtime and detection performance. It can both read and write barcodes in a number of formats. Since version 3.0 the default writing backend is provided by the [zint library](https://sourceforge.net/projects/zint/).
20
8
21
9
## Features
22
10
23
-
* Written in pure C++17 (/C++20), no third-party dependencies (for the library itself)
11
+
* Written in pure C++20 (public API is C++17 compatible), no third-party dependencies (for the library itself)
| QR Code | Model 1ᴿ, Model 2, Micro QR Code, rMQR
44
+
| ***Other:*** | *(Legacy, Niche)*
45
+
| Codabar |
46
+
| DXFilmEdge |
47
+
45
48
46
49
[Note:]
50
+
* ᵂ : write support only
51
+
* ᴿ : read support only
47
52
* DataBar used to be called RSS.
48
-
* DataBar, MaxiCode, Micro QR Code and rMQR Code are not supported for writing.
49
-
* Building with C++20 (see [CMakeLists.txt](https://github.com/zxing-cpp/zxing-cpp/blob/d4b0f502775857f257d13efd25fb840ece1bca3e/CMakeLists.txt#L45)) changes the behaviour of the library: it then supports multi-symbol and position independent detection for DataMatrix. This comes at a noticable performace cost. C++20 is enabled by default for the Android, iOS, Python and WASM wrappers.
53
+
* DataBar, DX Film Edge, MaxiCode, Micro QR Code and rMQR Code are not supported for writing if the library is configured with `ZXING_WRITERS=OLD`.
54
+
55
+
## Sponsors
56
+
57
+
You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/axxel).
58
+
59
+
|| Named Sponsors: |
60
+
|:-:|:-|
61
+
|[](https://github.com/kurzdigital)|[KURZ Digital Solutions GmbH & Co. KG](https://github.com/kurzdigital)|
|[](https://www.sap.com/germany/about/company/innovation/open-source.html)|[SAP (Open Source Program Office)](https://www.sap.com/germany/about/company/innovation/open-source.html)|
To see the full capability of the API, have a look at [`ZXingReader.cpp`](example/ZXingReader.cpp).
79
97
80
98
### To write barcodes:
81
-
1. Create a [`MultiFormatWriter`](core/src/MultiFormatWriter.h) instance with the format you want to generate. Set encoding and margins if needed.
82
-
2. Call `encode()` with text content and the image size. This returns a [`BitMatrix`](core/src/BitMatrix.h) which is a binary image of the barcode where `true` == visual black and `false` == visual white.
83
-
3. Convert the bit matrix to your native image format. See also the `ToMatrix<T>(BitMatrix&)` helper function.
99
+
1. Create a `Barcode` object with `CreateBarcodeFrom...()` from [`CreateBarcode.h`](core/src/CreateBarcode.h).
100
+
2. The `Barcode::symbol()` can be used to get access to the bit matrix (1 module == 1 pixel, no quiet zone)
101
+
3. Alternatively the 3 `WriteBarcodeTo...()` functions from [`WriteBarcode.h`](core/src/WriteBarcode.h) can be used to create an `Image`, a SVG string or a UTF-8 string representation.
102
+
103
+
A very simple example looks like this:
104
+
```c++
105
+
#include "ZXing/ZXingCpp.h"
106
+
#include <iostream>
107
+
108
+
int main(int argc, char** argv)
109
+
{
110
+
auto barcode = ZXing::CreateBarcodeFromText("some text", ZXing::BarcodeFormat::QRCode);
111
+
auto svg = ZXing::WriteBarcodeToSVG(barcode);
112
+
113
+
// see also ZXing::WriteBarcodeToImage()
114
+
115
+
std::cout << svg << "\n";
116
+
117
+
return 0;
118
+
}
119
+
```
84
120
85
-
As an example, have a look at [`ZXingWriter.cpp`](example/ZXingWriter.cpp).
121
+
As an example for how to parameterize the process with `CreatorOptions` and `WriterOptions`, have a look at [`ZXingWriter.cpp`](example/ZXingWriter.cpp).
@@ -94,14 +130,14 @@ As an example, have a look at [`ZXingWriter.cpp`](example/ZXingWriter.cpp).
94
130
## Build Instructions
95
131
These are the generic instructions to build the library on Windows/macOS/Linux. For details on how to build the individual wrappers, follow the links above.
96
132
97
-
1. Make sure [CMake](https://cmake.org) version 3.15 or newer is installed.
98
-
2. Make sure a C++17 compliant compiler is installed (minimum VS 2019 16.8 / gcc 7 / clang 5).
99
-
3. See the cmake `BUILD_...` options to enable the testing code, python wrapper, etc.
133
+
1. Make sure [CMake](https://cmake.org) version 3.16 or newer is installed. The python module requires 3.18 or higher.
134
+
2. Make sure a sufficiently C++20 compliant compiler is installed (minimum VS 2019 16.10? / gcc 11 / clang 12?).
135
+
3. See the cmake `ZXING_...` options to enable the testing code, python wrapper, etc.
0 commit comments