comparison mupdf-source/thirdparty/zxing-cpp/example/ZXingQtReader.cpp @ 3:2c135c81b16c

MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:44:09 +0200
parents b50eed0cc0ef
children
comparison
equal deleted inserted replaced
0:6015a75abc2d 3:2c135c81b16c
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 }