File: main.cpp

package info (click to toggle)
zxing-cpp 3.0.0%2Bds-1~exp2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 30,204 kB
  • sloc: ansic: 69,384; cpp: 34,587; php: 2,790; python: 199; makefile: 30; sh: 3
file content (22 lines) | stat: -rw-r--r-- 613 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "ZXing/ZXingCpp.h"

#include <iostream>

int main(int argc, char** argv)
{
	using namespace ZXing;

	auto copts = CreatorOptions(BarcodeFormat::QRCode, "eclevel=L");
	auto barcode = CreateBarcodeFromText("Test", copts);
	auto wopts = WriterOptions().scale(2);
	auto img = WriteBarcodeToImage(barcode, wopts);

	auto iv = ImageView(img.data(), img.width(), img.height(), img.format());
	auto ropts = ReaderOptions().formats(BarcodeFormat::AllLinear);
	auto barcodes = ReadBarcodes(iv, ropts);

	for (const auto& b : barcodes)
		std::cout << ToString(b.format()) << ": " << b.text() << "\n";

	return 0;
}