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
Copy file name to clipboardExpand all lines: README.md
+27-31Lines changed: 27 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,47 +27,56 @@ Same as ZXing, following barcode are supported:
27
27
|| RSS-14 |
28
28
|| RSS-Expanded |
29
29
30
+
## Getting Started
31
+
32
+
### To read barcodes:
33
+
As an example, have a look at [`ZXingReader.cpp`](example/ZXingReader.cpp).
34
+
1. Load your image into memory (3rd-party library required).
35
+
2. Call `ReadBarcode()` from [`ReadBarcode.h`](core/src/ReadBarcode.h), the simplest API to get a `Result`.
36
+
37
+
### To write barcodes:
38
+
As an example, have a look at [`ZXingWriter.cpp`](example/ZXingWriter.cpp).
39
+
1. Create a [`MultiFormatWriter`](core/src/MultiFormatWriter.h) instance with the format you want to generate. Set encoding and margins if needed.
40
+
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.
41
+
3. Convert the bit matrix to your native image format. See also the `ToMatrix<T>(BitMatrix&)` helper function.
-[Scan with camera](https://nu-book.github.io/zxing-cpp/zxing_viddemo.html)
34
47
35
-
36
48
## WinRT Package
37
49
A nuget package is available for WinRT: [huycn.zxingcpp.winrt](https://www.nuget.org/packages/huycn.zxingcpp.winrt).
38
50
To install it, run the following command in the Package Manager Console
39
51
```sh
40
52
PM> Install-Package huycn.zxingcpp.winrt
41
53
```
42
54
43
-
## Getting Started
44
-
The wrappers export very simple API to use, check `BarcodeReader` and `BarcodeGenerator` in each wrapper.
45
-
For more fine-grain control in scanning process, check [`MultiFormatReader`](core/src/MultiFormatReader.h) class. For more customization when generating particular barcode format, you need to instantiate appropriate writer, see [`MultiFormatWriter`](core/src/MultiFormatWriter.h) for more details.
55
+
## Build Instructions
46
56
57
+
### Standard setup on Windows/macOS/Linux
58
+
1. Make sure [CMake](https://cmake.org) version 3.10 or newer is installed.
59
+
2. Make sure a C++14 compliant compiler is installed (minimum VS 2017 15.0 / gcc 5 / clang 3.4)
60
+
3. See the cmake `BUILD_...` options to enable the testing code, python wrapper, etc.
47
61
48
-
## Build Instructions
49
-
### For Windows Desktop with VS
50
-
1. Download and install [CMake](https://cmake.org) if it's not already installed.
51
-
2. Open CMake GUI, specify [`wrappers/gdiplus`](wrappers/gdiplus) as source folder in the first input, specify the build output in the second input, and click on Generate.
52
-
3. At prompt, select "Visual Studio 14 2015" (or "Visual Studio 14 2015 Win64" if you want to build for x64 platform); leave the second input (Optional toolset...) empty; leave "Use default native compilers" checked; and click on Finish to generate the VS project. At the end, you will get a solution (.sln) in your binary output directory that you can open in VS. The project ZXingGdiPlus in the solution will generate a static library.
62
+
### Windows GDIPlus wrapper
63
+
1. Open CMake GUI, specify [`wrappers/gdiplus`](wrappers/gdiplus) as source folder in the first input, specify the build output in the second input, and click on Generate.
64
+
2. At prompt, select "Visual Studio 15 2017" (or "Visual Studio 15 2017 Win64" if you want to build for x64 platform); leave the second input (Optional toolset...) empty; leave "Use default native compilers" checked; and click on Finish to generate the VS project. At the end, you will get a solution (.sln) in your binary output directory that you can open in VS. The project ZXingGdiPlus in the solution will generate a static library.
53
65
54
-
### For Windows Universal Platform
66
+
### Windows Universal Platform
55
67
1. Download and install [CMake](https://cmake.org) 3.4 or more recent if it's not already installed.
56
68
2. Edit the file [`wrappers/winrt/BuildWinCom.bat`](wrappers/winrt/BuildWinCom.bat) to adjust the path to your CMake installation.
57
69
3. Double-click on the batch script to run it.
58
70
4. If the build succeeds, it will put the results in the folder UAP which is ready-to-use SDK extension.
59
71
60
-
### For Android NDK
61
-
Note: The original Java-only [ZXing](https://github.com/zxing/zxing) project has a very good support for Android, whether you want to use it
62
-
as external app via Intent or directly integrated into your app. You should consider using it first before
63
-
trying this library since involving with native code is always more complex than Java-only code. Performance-wise,
64
-
except for specific usecases, you won't notice the difference!
72
+
### Android NDK
73
+
Note: The original Java-only [ZXing](https://github.com/zxing/zxing) project has a very good support for Android, whether you want to use it as external app via Intent or directly integrated into your app. You should consider using it first before trying this library since involving with native code is always more complex than Java-only code. Performance-wise, except for specific usecases, you won't notice the difference!
65
74
66
75
1. Edit [`wrappers/android/jni/Application.mk`](wrappers/android/jni/Application.mk) and adjust for your project.
67
76
2. On command line, `cd` into [`wrappers/android/jni`](wrappers/android/jni), type `ndk-build` (or `ndk-build -j <number of your CPU cores>`)
68
77
3. Copy files in `libs` and `java` into corresponding folders of your Android project.
69
78
70
-
### For web browser (WebAssembly)
79
+
### WebAssembly
71
80
1.[Install Emscripten](https://kripken.github.io/emscripten-site/docs/getting_started/) if not done already.
72
81
2. In an empty build folder, invoke `emcmake cmake <path to zxing-cpp.git/wrappers/wasm>`.
73
82
3. Invoke `cmake --bulid .` to create `zxing.js` and `zxing.wasm` (and `_reader`/`_writer` versions).
@@ -76,16 +85,3 @@ except for specific usecases, you won't notice the difference!
76
85
You can also download the latest build output from the continuous integration system from the [Actions](https://github.com/nu-book/zxing-cpp/actions) tab. Look for 'wasm-artifacts'.
77
86
78
87
For usage examples see [reader](wrappers/wasm/demo_reader.html) and [writer](wrappers/wasm/demo_writer.html) demos or the [live demos](https://nu-book.github.io/zxing-cpp/).
79
-
80
-
### For other platforms
81
-
82
-
##### To read barcodes:
83
-
As an example, have a look at [`ZXingReader.cpp`](example/ZXingReader.cpp).
84
-
1. Load your image into memory (3rd-party library required).
85
-
2. Call `ReadBarcode()` from [`ReadBarcode.h`](core/src/ReadBarcode.h), the simplest API to get a `Result`.
86
-
87
-
##### To write barcodes:
88
-
As an example, have a look at [`ZXingWriter.cpp`](example/ZXingWriter.cpp).
89
-
1. Create a [`MultiFormatWriter`](core/src/MultiFormatWriter.h) instance with the format you want to generate. Set encoding and margins if needed.
90
-
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.
91
-
3. Convert the bit matrix to your native image format. See also the `ToMatrix<T>(BitMatrix&)` helper function.
0 commit comments