Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zxing-cpp/example/ZXingQtReader.cpp @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* | |
| 2 * Copyright 2020 Axel Waggershauser | |
| 3 */ | |
| 4 // SPDX-License-Identifier: Apache-2.0 | |
| 5 | |
| 6 #include "ZXingQtReader.h" | |
| 7 | |
| 8 #include <QDebug> | |
| 9 | |
| 10 using namespace ZXingQt; | |
| 11 | |
| 12 int main(int argc, char* argv[]) | |
| 13 { | |
| 14 if (argc != 2) { | |
| 15 qDebug() << "Please supply exactly one image filename"; | |
| 16 return 1; | |
| 17 } | |
| 18 | |
| 19 QString filePath = argv[1]; | |
| 20 | |
| 21 QImage image = QImage(filePath); | |
| 22 | |
| 23 if (image.isNull()) { | |
| 24 qDebug() << "Could not load the filename as an image:" << filePath; | |
| 25 return 1; | |
| 26 } | |
| 27 | |
| 28 auto options = ReaderOptions() | |
| 29 .setFormats(BarcodeFormat::MatrixCodes) | |
| 30 .setTryInvert(false) | |
| 31 .setTextMode(TextMode::HRI) | |
| 32 .setMaxNumberOfSymbols(10); | |
| 33 | |
| 34 auto barcodes = ReadBarcodes(image, options); | |
| 35 | |
| 36 for (auto& barcode : barcodes) { | |
| 37 qDebug() << "Text: " << barcode.text(); | |
| 38 qDebug() << "Format: " << barcode.format(); | |
| 39 qDebug() << "Content:" << barcode.contentType(); | |
| 40 qDebug() << ""; | |
| 41 } | |
| 42 | |
| 43 return barcodes.isEmpty() ? 1 : 0; | |
| 44 } |
