From cfdf02497328beed7cc461a5a4829e5d7db28a1b Mon Sep 17 00:00:00 2001 From: Markus Fisch Date: Mon, 14 Oct 2024 14:03:32 +0200 Subject: [PATCH] QRCode: add QR data mask to Barcode result --- core/src/Barcode.cpp | 6 ++++++ core/src/Barcode.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/core/src/Barcode.cpp b/core/src/Barcode.cpp index 41b2137d36..72c33c0c5f 100644 --- a/core/src/Barcode.cpp +++ b/core/src/Barcode.cpp @@ -47,6 +47,7 @@ Result::Result(DecoderResult&& decodeResult, DetectorResult&& detectorResult, Ba _position(std::move(detectorResult).position()), _sai(decodeResult.structuredAppend()), _format(format), + _dataMask(decodeResult.dataMask()), _lineCount(decodeResult.lineCount()), _isMirrored(decodeResult.isMirrored()), _readerInit(decodeResult.readerInit()) @@ -136,6 +137,11 @@ std::string Result::version() const return _version; } +int Result::dataMask() const +{ + return _dataMask; +} + Result& Result::setReaderOptions(const ReaderOptions& opts) { if (opts.characterSet() != CharacterSet::Unknown) diff --git a/core/src/Barcode.h b/core/src/Barcode.h index 051205ae41..8c1d9d019b 100644 --- a/core/src/Barcode.h +++ b/core/src/Barcode.h @@ -174,6 +174,11 @@ class Result */ std::string version() const; + /** + * @brief QRCode data mask. + */ + int dataMask() const; + #ifdef ZXING_EXPERIMENTAL_API void symbol(BitMatrix&& bits); ImageView symbol() const; @@ -192,6 +197,7 @@ class Result BarcodeFormat _format = BarcodeFormat::None; char _ecLevel[4] = {}; char _version[4] = {}; + int _dataMask = 0; int _lineCount = 0; bool _isMirrored = false; bool _isInverted = false;