zxing-cpp v3.0
Loading...
Searching...
No Matches
WriteBarcode.h
Go to the documentation of this file.
1/*
2* Copyright 2024 Axel Waggershauser
3*/
4// SPDX-License-Identifier: Apache-2.0
5
6#pragma once
7
8#include "Barcode.h"
9#include "ImageView.h"
10
11#include <memory>
12
13namespace ZXing {
14
27{
28 struct Data;
29
30 std::unique_ptr<Data> d;
31
32public:
36 WriterOptions& operator=(WriterOptions&&) noexcept;
37
38#define ZX_PROPERTY(TYPE, NAME) \
39 TYPE NAME() const noexcept; \
40 WriterOptions& NAME(TYPE v)&; \
41 WriterOptions&& NAME(TYPE v)&&;
42
45 ZX_PROPERTY(int, scale)
46
47
48 ZX_PROPERTY(int, rotate)
49
51 ZX_PROPERTY(bool, invert)
52
54 ZX_PROPERTY(bool, addHRT)
55
57 ZX_PROPERTY(bool, addQuietZones)
58
59#undef ZX_PROPERTY
60};
61
62
64std::string WriteBarcodeToSVG(const Barcode& barcode, const WriterOptions& options = {});
65
67std::string WriteBarcodeToUtf8(const Barcode& barcode, const WriterOptions& options = {});
68
70Image WriteBarcodeToImage(const Barcode& barcode, const WriterOptions& options = {});
71
72} // ZXing
The Barcode class encapsulates a decoded or created barcode symbol.
Definition Barcode.h:64
Simple class that inherits ImageView but owns the image data and frees it on destruction.
Definition ImageView.h:164
Configuration options for barcode writing/generation.
Definition WriteBarcode.h:27
int scale() const noexcept
WriterOptions(WriterOptions &&) noexcept
bool addHRT() const noexcept
add human readable text (HRI) to the barcode
bool addQuietZones() const noexcept
add quiet zones around the barcode (default: true)
int rotate() const noexcept
rotate the barcode by given degrees (0, 90, 180, 270)
bool invert() const noexcept
invert the colors of the barcode
Definition Barcode.h:26
Image WriteBarcodeToImage(const Barcode &barcode, const WriterOptions &options={})
Write barcode symbol to Image (Bitmap).
std::string WriteBarcodeToUtf8(const Barcode &barcode, const WriterOptions &options={})
Write barcode symbol to a utf8 string using graphical characters (e.g. '▀').
std::string WriteBarcodeToSVG(const Barcode &barcode, const WriterOptions &options={})
Write barcode symbol to SVG.