diff --git a/README.md b/README.md index 863557d957..894f12b735 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/ax Named Sponsors: * [KURZ Digital Solutions GmbH & Co. KG](https://github.com/kurzdigital) * [Useful Sensors Inc](https://github.com/usefulsensors) +* [EUREKAM](https://eurecam.fr/) Thanks a lot for your contribution! @@ -34,20 +35,20 @@ Thanks a lot for your contribution! ## Supported Formats -| Linear product | Linear industrial | Matrix | -|----------------|-------------------|--------------------| -| UPC-A | Code 39 | QR Code | -| UPC-E | Code 93 | Micro QR Code | -| EAN-8 | Code 128 | rMQR Code | -| EAN-13 | Codabar | Aztec | -| DataBar | DataBar Expanded | DataMatrix | -| | DX Film Edge | PDF417 | -| | ITF | MaxiCode (partial) | +| Linear product | Linear industrial | Matrix | +|-----------------|-------------------|--------------------| +| UPC-A | Code 39 | QR Code | +| UPC-E | Code 93 | Micro QR Code | +| EAN-8 | Code 128 | rMQR Code | +| EAN-13 | Codabar | Aztec | +| DataBar | DataBar Expanded | DataMatrix | +| DataBar Limited | DX Film Edge | PDF417 | +| | ITF | MaxiCode (partial) | [Note:] * DataBar used to be called RSS. * DataBar, DX Film Edge, MaxiCode, Micro QR Code and rMQR Code are not supported for writing. - * Building with only C++17 (see [CMakeLists.txt](https://github.com/zxing-cpp/zxing-cpp/blob/d4b0f502775857f257d13efd25fb840ece1bca3e/CMakeLists.txt#L45)) changes the behaviour of the library: it then lacks supports multi-symbol and position independent detection for DataMatrix. + * Building with only C++17 (see [CMakeLists.txt](https://github.com/zxing-cpp/zxing-cpp/blob/d4b0f502775857f257d13efd25fb840ece1bca3e/CMakeLists.txt#L45)) changes the behaviour of the library: it then lacks support for DataBarLimited and multi-symbol and position independent detection for DataMatrix. ## Getting Started diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 7faec83ca3..d7ea297a96 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -347,6 +347,8 @@ if (ZXING_READERS) src/oned/ODDataBarExpandedBitDecoder.cpp src/oned/ODDataBarExpandedReader.h src/oned/ODDataBarExpandedReader.cpp + src/oned/ODDataBarLimitedReader.h + src/oned/ODDataBarLimitedReader.cpp src/oned/ODDXFilmEdgeReader.h src/oned/ODDXFilmEdgeReader.cpp src/oned/ODITFReader.h diff --git a/core/src/BarcodeFormat.cpp b/core/src/BarcodeFormat.cpp index b43917764e..4f7b0a2b99 100644 --- a/core/src/BarcodeFormat.cpp +++ b/core/src/BarcodeFormat.cpp @@ -31,6 +31,7 @@ static BarcodeFormatName NAMES[] = { {BarcodeFormat::Code128, "Code128"}, {BarcodeFormat::DataBar, "DataBar"}, {BarcodeFormat::DataBarExpanded, "DataBarExpanded"}, + {BarcodeFormat::DataBarLimited, "DataBarLimited"}, {BarcodeFormat::DataMatrix, "DataMatrix"}, {BarcodeFormat::DXFilmEdge, "DXFilmEdge"}, {BarcodeFormat::EAN8, "EAN-8"}, diff --git a/core/src/BarcodeFormat.h b/core/src/BarcodeFormat.h index f2d56edad7..1b29272410 100644 --- a/core/src/BarcodeFormat.h +++ b/core/src/BarcodeFormat.h @@ -41,12 +41,14 @@ enum class BarcodeFormat MicroQRCode = (1 << 16), ///< Micro QR Code RMQRCode = (1 << 17), ///< Rectangular Micro QR Code DXFilmEdge = (1 << 18), ///< DX Film Edge Barcode + DataBarLimited = (1 << 19), ///< GS1 DataBar Limited - LinearCodes = Codabar | Code39 | Code93 | Code128 | EAN8 | EAN13 | ITF | DataBar | DataBarExpanded | DXFilmEdge | UPCA | UPCE, + LinearCodes = Codabar | Code39 | Code93 | Code128 | EAN8 | EAN13 | ITF | DataBar | DataBarExpanded | DataBarLimited + | DXFilmEdge | UPCA | UPCE, MatrixCodes = Aztec | DataMatrix | MaxiCode | PDF417 | QRCode | MicroQRCode | RMQRCode, Any = LinearCodes | MatrixCodes, - _max = DXFilmEdge, ///> implementation detail, don't use + _max = DataBarLimited, ///> implementation detail, don't use }; ZX_DECLARE_FLAGS(BarcodeFormats, BarcodeFormat) diff --git a/core/src/WriteBarcode.cpp b/core/src/WriteBarcode.cpp index e290bdcd6d..9680cd2a34 100644 --- a/core/src/WriteBarcode.cpp +++ b/core/src/WriteBarcode.cpp @@ -157,6 +157,7 @@ static constexpr BarcodeFormatZXing2Zint barcodeFormatZXing2Zint[] = { {BarcodeFormat::Code128, BARCODE_CODE128}, {BarcodeFormat::DataBar, BARCODE_DBAR_OMN}, {BarcodeFormat::DataBarExpanded, BARCODE_DBAR_EXP}, + {BarcodeFormat::DataBarLimited, BARCODE_DBAR_LTD}, {BarcodeFormat::DataMatrix, BARCODE_DATAMATRIX}, {BarcodeFormat::DXFilmEdge, -1}, {BarcodeFormat::EAN8, BARCODE_EANX}, diff --git a/core/src/ZXingC.h b/core/src/ZXingC.h index 8b10bfefbf..e88e24c8db 100644 --- a/core/src/ZXingC.h +++ b/core/src/ZXingC.h @@ -97,11 +97,13 @@ typedef enum ZXing_BarcodeFormat_MicroQRCode = (1 << 16), ZXing_BarcodeFormat_RMQRCode = (1 << 17), ZXing_BarcodeFormat_DXFilmEdge = (1 << 18), + ZXing_BarcodeFormat_DataBarLimited = (1 << 19), ZXing_BarcodeFormat_LinearCodes = ZXing_BarcodeFormat_Codabar | ZXing_BarcodeFormat_Code39 | ZXing_BarcodeFormat_Code93 | ZXing_BarcodeFormat_Code128 | ZXing_BarcodeFormat_EAN8 | ZXing_BarcodeFormat_EAN13 | ZXing_BarcodeFormat_ITF | ZXing_BarcodeFormat_DataBar | ZXing_BarcodeFormat_DataBarExpanded - | ZXing_BarcodeFormat_DXFilmEdge | ZXing_BarcodeFormat_UPCA | ZXing_BarcodeFormat_UPCE, + | ZXing_BarcodeFormat_DataBarLimited | ZXing_BarcodeFormat_DXFilmEdge | ZXing_BarcodeFormat_UPCA + | ZXing_BarcodeFormat_UPCE, ZXing_BarcodeFormat_MatrixCodes = ZXing_BarcodeFormat_Aztec | ZXing_BarcodeFormat_DataMatrix | ZXing_BarcodeFormat_MaxiCode | ZXing_BarcodeFormat_PDF417 | ZXing_BarcodeFormat_QRCode | ZXing_BarcodeFormat_MicroQRCode | ZXing_BarcodeFormat_RMQRCode, diff --git a/core/src/oned/ODDataBarCommon.cpp b/core/src/oned/ODDataBarCommon.cpp index 2b85607428..4ca091a139 100644 --- a/core/src/oned/ODDataBarCommon.cpp +++ b/core/src/oned/ODDataBarCommon.cpp @@ -36,7 +36,11 @@ static int combins(int n, int r) return val; } +#ifdef __cpp_lib_span +int GetValue(const std::span widths, int maxWidth, bool noNarrow) +#else int GetValue(const Array4I& widths, int maxWidth, bool noNarrow) +#endif { int elements = Size(widths); int n = Reduce(widths); @@ -65,13 +69,6 @@ int GetValue(const Array4I& widths, int maxWidth, bool noNarrow) return val; } -template -struct OddEven -{ - T odd = {}, evn = {}; - T& operator[](int i) { return i & 1 ? evn : odd; } -}; - using Array4F = std::array; bool ReadDataCharacterRaw(const PatternView& view, int numModules, bool reversed, Array4I& oddPattern, diff --git a/core/src/oned/ODDataBarCommon.h b/core/src/oned/ODDataBarCommon.h index 7e5e7c2dcb..5e6bd893dd 100644 --- a/core/src/oned/ODDataBarCommon.h +++ b/core/src/oned/ODDataBarCommon.h @@ -12,6 +12,10 @@ #include #include +#if __has_include() // c++20 +#include +#endif + namespace ZXing::OneD::DataBar { inline bool IsFinder(int a, int b, int c, int d, int e) @@ -121,12 +125,23 @@ int ParseFinderPattern(const PatternView& view, bool reversed, T l2rPattern, T r return reversed ? -i : i; } +template +struct OddEven +{ + T odd = {}, evn = {}; + T& operator[](int i) { return i & 1 ? evn : odd; } +}; + using Array4I = std::array; bool ReadDataCharacterRaw(const PatternView& view, int numModules, bool reversed, Array4I& oddPattern, Array4I& evnPattern); +#ifdef __cpp_lib_span +int GetValue(const std::span widths, int maxWidth, bool noNarrow); +#else int GetValue(const Array4I& widths, int maxWidth, bool noNarrow); +#endif Position EstimatePosition(const Pair& first, const Pair& last); int EstimateLineCount(const Pair& first, const Pair& last); diff --git a/core/src/oned/ODDataBarLimitedReader.cpp b/core/src/oned/ODDataBarLimitedReader.cpp new file mode 100644 index 0000000000..3eaf8fef73 --- /dev/null +++ b/core/src/oned/ODDataBarLimitedReader.cpp @@ -0,0 +1,199 @@ +/* +* Copyright 2024 Axel Waggershauser +*/ +// SPDX-License-Identifier: Apache-2.0 + +#include "ODDataBarLimitedReader.h" + +#include "BarcodeFormat.h" +#include "GTIN.h" +#include "ODDataBarCommon.h" +#include "Barcode.h" + +//#define PRINT_DEBUG +#ifndef PRINT_DEBUG +#define printf(...){} +#define printv(...){} +#else +#define printv(fmt, ...) \ +for (auto v : __VA_ARGS__) \ + printf(fmt, v); +#endif + +namespace ZXing::OneD { + +using namespace DataBar; + +constexpr int CHAR_LEN = 14; +constexpr int SYMBOL_LEN = 1 + 3 * CHAR_LEN + 2; + +// elements() determines the element widths of an (n,k) character with +// at least one even-numbered element that's just one module wide. +// (Note: even-numbered elements - 2nd, 4th, 6th, etc., have odd indexes) +// for DataBarLimited: SUM=26/18, LEN=14 +template +std::array NormalizedPatternFromE2E(const PatternView& view) +{ + auto e2e = NormalizedE2EPattern(view); + std::array widths; + + // derive element widths from normalized edge-to-similar-edge measurements + int barSum = widths[0] = 1; // first assume 1st bar is 1 + for (int i = 0; i < Size(e2e); i++) { + widths[i + 1] = e2e[i] - widths[i]; + barSum += widths[i + 1]; + } + widths.back() = SUM - barSum; // last even element makes SUM modules + + int minEven = widths[1]; + for (int i = 3; i < Size(widths); i += 2) + minEven = std::min(minEven, widths[i]); + + if (minEven > 1) { + // minimum even width is too big, readjust so minimum even is 1 + for (int i = 0; i < Size(widths); i += 2) { + widths[i] += minEven - 1; + widths[i + 1] -= minEven - 1; + } + } + + return widths; +} + +static Character ReadDataCharacter(const PatternView& view) +{ + constexpr int G_SUM[] = {0, 183064, 820064, 1000776, 1491021, 1979845, 1996939}; + constexpr int T_EVEN[] = {28, 728, 6454, 203, 2408, 1, 16632}; + constexpr int ODD_SUM[] = {17, 13, 9, 15, 11, 19, 7}; + constexpr int ODD_WIDEST[] = {6, 5, 3, 5, 4, 8, 1}; + + auto pattern = NormalizedPatternFromE2E<14, 26>(view); + + int checkSum = 0; + for (auto it = pattern.rbegin(); it != pattern.rend(); ++it) + checkSum = 3 * checkSum + *it; + + using Array7I = std::array; + Array7I oddPattern = {}, evnPattern = {}; + OddEven res = {oddPattern, evnPattern}; + + for (int i = 0; i < Size(pattern); ++i) + res[i % 2][i / 2] = pattern[i]; + + printf(" o: "); + printv("%d ", oddPattern); + printf(" e: "); + printv("%d ", evnPattern); + + int group = IndexOf(ODD_SUM, Reduce(oddPattern)); + if (group == -1) + return {}; + + int oddWidest = ODD_WIDEST[group]; + int evnWidest = 9 - oddWidest; +#ifndef __cpp_lib_span +#warning "DataBarLimited not supported without std::span<> (c++20 feature)" + int vOdd = 0; + int vEvn = 0; +#else + int vOdd = GetValue(oddPattern, oddWidest, false); + int vEvn = GetValue(evnPattern, evnWidest, true); +#endif + int tEvn = T_EVEN[group]; + int gSum = G_SUM[group]; + + return {vOdd * tEvn + vEvn + gSum, checkSum}; +} + +static std::string ConstructText(Character left, Character right) +{ + auto symVal = 2'013'571LL * left.value + right.value; + + // Strip 2D linkage flag (GS1 Composite) if any (ISO/IEC 24724:2011 Section 6.2.3) + if (symVal >= 2'015'133'531'096LL) { + symVal -= 2'015'133'531'096LL; + assert(symVal <= 1'999'999'999'999LL); // 13 digits + } + auto txt = ToString(symVal, 13); + return "01" + txt + GTIN::ComputeCheckDigit(txt); +} + +static inline bool Has26to18Ratio(int v26, int v18) +{ + return v26 + 1.5 * v26 / 26 > v18 / 18. * 26. && v26 - 1.5 * v26 / 26 < v18 / 18. * 26.; +} + +std::array CheckChars = { + 0b10'10101010'11100010, 0b10'10101010'01110010, 0b10'10101010'00111010, 0b10'10101001'01110010, 0b10'10101001'00111010, + 0b10'10101000'10111010, 0b10'10100101'01110010, 0b10'10100101'00111010, 0b10'10100100'10111010, 0b10'10100010'10111010, + 0b10'10010101'01110010, 0b10'10010101'00111010, 0b10'10010100'10111010, 0b10'10010010'10111010, 0b10'10001010'10111010, + 0b10'01010101'01110010, 0b10'01010101'00111010, 0b10'01010100'10111010, 0b10'01010010'10111010, 0b10'01001010'10111010, + 0b10'00101010'10111010, 0b10'10101011'01100010, 0b10'10101011'00110010, 0b10'10101011'00011010, 0b10'10101001'10110010, + 0b10'10101001'10011010, 0b10'10101000'11011010, 0b10'10100101'10110010, 0b10'10100101'10011010, 0b10'10100100'11011010, + 0b10'10100010'11011010, 0b10'10010101'10110010, 0b10'10010101'10011010, 0b10'10010100'11011010, 0b10'10010010'11011010, + 0b10'10001010'11011010, 0b10'01010101'10110010, 0b10'01010101'10011010, 0b10'01010100'11011010, 0b10'01010010'11011010, + 0b10'01001010'11011010, 0b10'00101010'11011010, 0b10'10101011'10100010, 0b10'10101011'10010010, 0b10'10101001'11010010, + 0b10'10010101'11010010, 0b10'01010101'11010010, 0b10'10101101'01100010, 0b10'10101101'00110010, 0b10'10101101'00011010, + 0b10'10101100'10110010, 0b10'10010110'10110010, 0b10'10010110'10011010, 0b10'10010110'01011010, 0b10'10010011'01011010, + 0b10'10001011'01011010, 0b10'01010110'10110010, 0b10'01010110'10011010, 0b10'01001011'01011010, 0b10'10110101'01100010, + 0b10'10110101'00110010, 0b10'10110101'00011010, 0b10'10110100'10110010, 0b10'10110100'10011010, 0b10'10110010'10110010, + 0b10'01011010'10110010, 0b10'01011010'10011010, 0b10'01011010'01011010, 0b10'01011001'01011010, 0b10'01001101'01011010, + 0b10'00101101'01011010, 0b10'11010101'01100010, 0b10'11010101'00110010, 0b10'11010101'00011010, 0b10'11010100'10110010, + 0b10'11010100'10011010, 0b10'11010100'01011010, 0b10'11010010'10110010, 0b10'11010010'10011010, 0b10'11001010'10110010, + 0b11'01010101'00110010, 0b11'01010101'00011010, 0b11'01010100'10110010, 0b11'01010100'10011010, 0b11'01010100'01011010, + 0b11'01010010'10011010, 0b11'01010010'01011010, 0b11'01001010'10011010, 0b11'01010101'10010010, +}; + +Barcode DataBarLimitedReader::decodePattern(int rowNumber, PatternView& next, std::unique_ptr&) const +{ + next = next.subView(-2, SYMBOL_LEN); + while (next.shift(2)) { + if (!IsGuard(next[27], next[43])) + continue; + auto spaceSize = (next[27] + next[43]) / 2; + if ((!next.isAtFirstBar() && next[-1] < spaceSize) || (!next.isAtLastBar() && next[SYMBOL_LEN] < 4 * spaceSize)) + continue; + auto [mBar, MBar] = std::minmax({next[0], next[28], next[44]}); + if (MBar > mBar * 4 / 3 + 1) + continue; + + auto leftView = next.subView(1 + 0 * CHAR_LEN, CHAR_LEN); + auto checkView = next.subView(1 + 1 * CHAR_LEN, CHAR_LEN); + auto rightView = next.subView(1 + 2 * CHAR_LEN, CHAR_LEN); + auto leftWidth = leftView.sum(); + auto checkWith = checkView.sum(); + auto rightWidth = rightView.sum(); + if (!Has26to18Ratio(leftWidth, checkWith) || !Has26to18Ratio(rightWidth, checkWith)) + continue; + + auto modSize = double(leftWidth + checkWith + rightWidth) / (26 + 18 + 26); + if ((!next.isAtFirstBar() && next[-1] < modSize) || (!next.isAtLastBar() && next[SYMBOL_LEN] < 5 * modSize)) + continue; + + auto checkCharPattern = ToInt(NormalizedPatternFromE2E(checkView)); + int checkSum = IndexOf(CheckChars, checkCharPattern); + if (checkSum == -1) + continue; + + printf("%f - ", modSize); + printv("%d ", NormalizedPatternFromE2E(checkView)); + + auto left = ReadDataCharacter(leftView); + auto right = ReadDataCharacter(rightView); + + printf("- %d, %d, %d\n", checkSum, left.value, right.value); + + if ((left.checksum + 20 * right.checksum) % 89 != checkSum) + continue; + + return {ConstructText(left, right), rowNumber, next.pixelsInFront(), next.pixelsTillEnd(), + BarcodeFormat::DataBarLimited, {'e', '0'}}; + } + + // guarantee progress (see loop in ODReader.cpp) + next = {}; + + return {}; +} + +} // namespace ZXing::OneD diff --git a/core/src/oned/ODDataBarLimitedReader.h b/core/src/oned/ODDataBarLimitedReader.h new file mode 100644 index 0000000000..e290406a6b --- /dev/null +++ b/core/src/oned/ODDataBarLimitedReader.h @@ -0,0 +1,23 @@ +/* +* Copyright 2024 Axel Waggershauser +*/ +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include "ODRowReader.h" + +namespace ZXing::OneD { + +/** +* Decodes DataBarLimited sybmols. See ISO/IEC 24724:2011. +*/ +class DataBarLimitedReader : public RowReader +{ +public: + using RowReader::RowReader; + + Barcode decodePattern(int rowNumber, PatternView& next, std::unique_ptr& state) const override; +}; + +} // namespace ZXing::OneD diff --git a/core/src/oned/ODReader.cpp b/core/src/oned/ODReader.cpp index b354f05e3c..f6e52e4020 100644 --- a/core/src/oned/ODReader.cpp +++ b/core/src/oned/ODReader.cpp @@ -14,6 +14,7 @@ #include "ODCode39Reader.h" #include "ODCode93Reader.h" #include "ODDataBarExpandedReader.h" +#include "ODDataBarLimitedReader.h" #include "ODDataBarReader.h" #include "ODDXFilmEdgeReader.h" #include "ODITFReader.h" @@ -62,6 +63,8 @@ Reader::Reader(const ReaderOptions& opts) : ZXing::Reader(opts) _readers.emplace_back(new DataBarReader(opts)); if (formats.testFlags(BarcodeFormat::DataBarExpanded)) _readers.emplace_back(new DataBarExpandedReader(opts)); + if (formats.testFlags(BarcodeFormat::DataBarLimited)) + _readers.emplace_back(new DataBarLimitedReader(opts)); if (formats.testFlag(BarcodeFormat::DXFilmEdge)) _readers.emplace_back(new DXFilmEdgeReader(opts)); } diff --git a/example/ZXingQtReader.h b/example/ZXingQtReader.h index d4845e4ab2..629f44423b 100644 --- a/example/ZXingQtReader.h +++ b/example/ZXingQtReader.h @@ -53,8 +53,9 @@ enum class BarcodeFormat MicroQRCode = (1 << 16), ///< Micro QR Code RMQRCode = (1 << 17), ///< Rectangular Micro QR Code DXFilmEdge = (1 << 18), ///< DX Film Edge Barcode + DataBarLimited = (1 << 19), ///< GS1 DataBar Limited - LinearCodes = Codabar | Code39 | Code93 | Code128 | EAN8 | EAN13 | ITF | DataBar | DataBarExpanded | DXFilmEdge | UPCA | UPCE, + LinearCodes = Codabar | Code39 | Code93 | Code128 | EAN8 | EAN13 | ITF | DataBar | DataBarExpanded | DataBarLimited | DXFilmEdge | UPCA | UPCE, MatrixCodes = Aztec | DataMatrix | MaxiCode | PDF417 | QRCode | MicroQRCode | RMQRCode, }; diff --git a/wrappers/android/zxingcpp/src/main/cpp/ZXingCpp.cpp b/wrappers/android/zxingcpp/src/main/cpp/ZXingCpp.cpp index 0c3bcaef7e..54d7c39aa9 100644 --- a/wrappers/android/zxingcpp/src/main/cpp/ZXingCpp.cpp +++ b/wrappers/android/zxingcpp/src/main/cpp/ZXingCpp.cpp @@ -45,6 +45,7 @@ static const char* JavaBarcodeFormatName(BarcodeFormat format) case BarcodeFormat::RMQRCode: return "RMQR_CODE"; case BarcodeFormat::DataBar: return "DATA_BAR"; case BarcodeFormat::DataBarExpanded: return "DATA_BAR_EXPANDED"; + case BarcodeFormat::DataBarLimited: return "DATA_BAR_LIMITED"; case BarcodeFormat::DXFilmEdge: return "DX_FILM_EDGE"; case BarcodeFormat::UPCA: return "UPC_A"; case BarcodeFormat::UPCE: return "UPC_E"; diff --git a/wrappers/android/zxingcpp/src/main/java/zxingcpp/BarcodeReader.kt b/wrappers/android/zxingcpp/src/main/java/zxingcpp/BarcodeReader.kt index b7b9d1f36a..b1872f9b51 100644 --- a/wrappers/android/zxingcpp/src/main/java/zxingcpp/BarcodeReader.kt +++ b/wrappers/android/zxingcpp/src/main/java/zxingcpp/BarcodeReader.kt @@ -28,7 +28,7 @@ public class BarcodeReader(public var options: Options = Options()) { // Enumerates barcode formats known to this package. // Note that this has to be kept synchronized with native (C++/JNI) side. public enum class Format { - NONE, AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_BAR, DATA_BAR_EXPANDED, + NONE, AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_BAR, DATA_BAR_EXPANDED, DATA_BAR_LIMITED, DATA_MATRIX, DX_FILM_EDGE, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, MICRO_QR_CODE, RMQR_CODE, UPC_A, UPC_E } diff --git a/wrappers/dotnet/ZXingCpp/ZXingCpp.cs b/wrappers/dotnet/ZXingCpp/ZXingCpp.cs index ba999c041e..c422a8268b 100644 --- a/wrappers/dotnet/ZXingCpp/ZXingCpp.cs +++ b/wrappers/dotnet/ZXingCpp/ZXingCpp.cs @@ -165,8 +165,9 @@ public enum BarcodeFormats MicroQRCode = (1 << 16), ///< Micro QR Code RMQRCode = (1 << 17), ///< Rectangular Micro QR Code DXFilmEdge = (1 << 18), ///< DX Film Edge Barcode + DataBarLimited = (1 << 19), ///< GS1 DataBar Limited - LinearCodes = Codabar | Code39 | Code93 | Code128 | EAN8 | EAN13 | ITF | DataBar | DataBarExpanded | DXFilmEdge | UPCA | UPCE, + LinearCodes = Codabar | Code39 | Code93 | Code128 | EAN8 | EAN13 | ITF | DataBar | DataBarExpanded | DataBarLimited | DXFilmEdge | UPCA | UPCE, MatrixCodes = Aztec | DataMatrix | MaxiCode | PDF417 | QRCode | MicroQRCode | RMQRCode, Any = LinearCodes | MatrixCodes, }; diff --git a/wrappers/ios/Sources/Wrapper/ZXIFormat.h b/wrappers/ios/Sources/Wrapper/ZXIFormat.h index 78156102b7..a80ae19240 100644 --- a/wrappers/ios/Sources/Wrapper/ZXIFormat.h +++ b/wrappers/ios/Sources/Wrapper/ZXIFormat.h @@ -7,7 +7,7 @@ #define ZXIFormat_h typedef NS_ENUM(NSInteger, ZXIFormat) { - NONE, AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_BAR, DATA_BAR_EXPANDED, + NONE, AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_BAR, DATA_BAR_EXPANDED, DATA_BAR_LIMITED, DATA_MATRIX, DX_FILM_EDGE, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, MICRO_QR_CODE, RMQR_CODE, UPC_A, UPC_E, LINEAR_CODES, MATRIX_CODES, ANY }; diff --git a/wrappers/ios/Sources/Wrapper/ZXIFormatHelper.mm b/wrappers/ios/Sources/Wrapper/ZXIFormatHelper.mm index 64ebfd7a97..42b347043d 100644 --- a/wrappers/ios/Sources/Wrapper/ZXIFormatHelper.mm +++ b/wrappers/ios/Sources/Wrapper/ZXIFormatHelper.mm @@ -32,6 +32,8 @@ return ZXing::BarcodeFormat::DataMatrix; case ZXIFormat::DATA_BAR_EXPANDED: return ZXing::BarcodeFormat::DataBarExpanded; + case ZXIFormat::DATA_BAR_LIMITED: + return ZXing::BarcodeFormat::DataBarLimited; case ZXIFormat::DATA_BAR: return ZXing::BarcodeFormat::DataBar; case ZXIFormat::DX_FILM_EDGE: @@ -75,6 +77,8 @@ ZXIFormat ZXIFormatFromBarcodeFormat(ZXing::BarcodeFormat format) { return ZXIFormat::DATA_BAR; case ZXing::BarcodeFormat::DataBarExpanded: return ZXIFormat::DATA_BAR_EXPANDED; + case ZXing::BarcodeFormat::DataBarLimited: + return ZXIFormat::DATA_BAR_LIMITED; case ZXing::BarcodeFormat::DataMatrix: return ZXIFormat::DATA_MATRIX; case ZXing::BarcodeFormat::DXFilmEdge: diff --git a/wrappers/kn/src/nativeMain/kotlin/zxingcpp/BarcodeFormat.kt b/wrappers/kn/src/nativeMain/kotlin/zxingcpp/BarcodeFormat.kt index 08f38ee2b4..d8aee576de 100644 --- a/wrappers/kn/src/nativeMain/kotlin/zxingcpp/BarcodeFormat.kt +++ b/wrappers/kn/src/nativeMain/kotlin/zxingcpp/BarcodeFormat.kt @@ -18,6 +18,7 @@ enum class BarcodeFormat(internal val rawValue: UInt) { Code128(ZXing_BarcodeFormat_Code128), DataBar(ZXing_BarcodeFormat_DataBar), DataBarExpanded(ZXing_BarcodeFormat_DataBarExpanded), + DataBarLimited(ZXing_BarcodeFormat_DataBarLimited), DataMatrix(ZXing_BarcodeFormat_DataMatrix), DXFilmEdge(ZXing_BarcodeFormat_DXFilmEdge), EAN8(ZXing_BarcodeFormat_EAN8), diff --git a/wrappers/python/zxing.cpp b/wrappers/python/zxing.cpp index 4f3c0e521d..4afbb4f18c 100644 --- a/wrappers/python/zxing.cpp +++ b/wrappers/python/zxing.cpp @@ -235,6 +235,7 @@ PYBIND11_MODULE(zxingcpp, m) .value("RMQRCode", BarcodeFormat::RMQRCode) .value("DataBar", BarcodeFormat::DataBar) .value("DataBarExpanded", BarcodeFormat::DataBarExpanded) + .value("DataBarLimited", BarcodeFormat::DataBarLimited) .value("DXFilmEdge", BarcodeFormat::DXFilmEdge) .value("UPCA", BarcodeFormat::UPCA) .value("UPCE", BarcodeFormat::UPCE) diff --git a/wrappers/rust/src/bindings.rs b/wrappers/rust/src/bindings.rs index 6b8662fea1..a500804890 100644 --- a/wrappers/rust/src/bindings.rs +++ b/wrappers/rust/src/bindings.rs @@ -65,9 +65,10 @@ pub const ZXing_BarcodeFormat_UPCE: ZXing_BarcodeFormat = 32768; pub const ZXing_BarcodeFormat_MicroQRCode: ZXing_BarcodeFormat = 65536; pub const ZXing_BarcodeFormat_RMQRCode: ZXing_BarcodeFormat = 131072; pub const ZXing_BarcodeFormat_DXFilmEdge: ZXing_BarcodeFormat = 262144; -pub const ZXing_BarcodeFormat_LinearCodes: ZXing_BarcodeFormat = 313214; +pub const ZXing_BarcodeFormat_DataBarLimited: ZXing_BarcodeFormat = 524288; +pub const ZXing_BarcodeFormat_LinearCodes: ZXing_BarcodeFormat = 837502; pub const ZXing_BarcodeFormat_MatrixCodes: ZXing_BarcodeFormat = 211073; -pub const ZXing_BarcodeFormat_Any: ZXing_BarcodeFormat = 524287; +pub const ZXing_BarcodeFormat_Any: ZXing_BarcodeFormat = 1048575; pub const ZXing_BarcodeFormat_Invalid: ZXing_BarcodeFormat = 4294967295; pub type ZXing_BarcodeFormat = ::core::ffi::c_uint; pub use self::ZXing_BarcodeFormat as ZXing_BarcodeFormats; diff --git a/wrappers/rust/src/lib.rs b/wrappers/rust/src/lib.rs index 05f33eabec..26a234e640 100644 --- a/wrappers/rust/src/lib.rs +++ b/wrappers/rust/src/lib.rs @@ -222,8 +222,9 @@ make_zxing_enum!(EanAddOnSymbol { Ignore, Read, Require }); #[rustfmt::skip] make_zxing_flags!(BarcodeFormat { - None, Aztec, Codabar, Code39, Code93, Code128, DataBar, DataBarExpanded, DataMatrix, EAN8, EAN13, ITF, - MaxiCode, PDF417, QRCode, UPCA, UPCE, MicroQRCode, RMQRCode, DXFilmEdge, LinearCodes, MatrixCodes, Any + None, Aztec, Codabar, Code39, Code93, Code128, DataBar, DataBarExpanded, DataBarLimited, DataMatrix, + EAN8, EAN13, ITF, MaxiCode, PDF417, QRCode, UPCA, UPCE, MicroQRCode, RMQRCode, DXFilmEdge, + LinearCodes, MatrixCodes, Any }); impl Display for BarcodeFormat { diff --git a/wrappers/wasm/demo_cam_reader.html b/wrappers/wasm/demo_cam_reader.html index 59d4950031..1b693c9c4d 100644 --- a/wrappers/wasm/demo_cam_reader.html +++ b/wrappers/wasm/demo_cam_reader.html @@ -32,6 +32,7 @@

zxing-cpp/wasm live demo

+ diff --git a/wrappers/wasm/demo_reader.html b/wrappers/wasm/demo_reader.html index 6d3ba0f61f..f51bc3bed8 100644 --- a/wrappers/wasm/demo_reader.html +++ b/wrappers/wasm/demo_reader.html @@ -116,6 +116,7 @@

zxing-cpp/wasm reader demo

+ diff --git a/wrappers/winrt/BarcodeReader.cpp b/wrappers/winrt/BarcodeReader.cpp index d535dac155..6f074a982c 100644 --- a/wrappers/winrt/BarcodeReader.cpp +++ b/wrappers/winrt/BarcodeReader.cpp @@ -98,6 +98,8 @@ BarcodeFormat BarcodeReader::ConvertRuntimeToNative(BarcodeType type) return BarcodeFormat::DataBar; case BarcodeType::RSS_EXPANDED: return BarcodeFormat::DataBarExpanded; + case BarcodeType::DATA_BAR_LIMITED: + return BarcodeFormat::DataBarLimited; case BarcodeType::DX_FILM_EDGE: return BarcodeFormat::DXFilmEdge; case BarcodeType::UPC_A: @@ -145,6 +147,8 @@ BarcodeType BarcodeReader::ConvertNativeToRuntime(BarcodeFormat format) return BarcodeType::RSS_14; case BarcodeFormat::DataBarExpanded: return BarcodeType::RSS_EXPANDED; + case BarcodeFormat::DataBarLimited: + return BarcodeType::DATA_BAR_LIMITED; case BarcodeFormat::DXFilmEdge: return BarcodeType::DX_FILM_EDGE; case BarcodeFormat::UPCA: diff --git a/wrappers/winrt/BarcodeReader.h b/wrappers/winrt/BarcodeReader.h index f70be9f73a..c8d1a48c74 100644 --- a/wrappers/winrt/BarcodeReader.h +++ b/wrappers/winrt/BarcodeReader.h @@ -30,6 +30,7 @@ public enum class BarcodeType : int { RMQR_CODE, RSS_14, RSS_EXPANDED, + DATA_BAR_LIMITED, UPC_A, UPC_E };