zxing-cpp: strip to core library only (remove tests/wrappers/examples/docs); .gitignore: fix /core to allow zxing-cpp/core/ dir
This commit is contained in:
1 parent
22c24d135e
commit
8051dfe4e5
2506 files changed
+57271
-30087
No files matched your search
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2024 Axel Waggershauser
|
||||
*/
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Barcode.h"
|
||||
#include "ImageView.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ZXing {
|
||||
|
||||
/**
|
||||
* @brief Configuration options for barcode writing/generation.
|
||||
*
|
||||
* WriterOptions provides a fluent interface for setting various parameters
|
||||
* that control how barcodes are generated.
|
||||
*
|
||||
* This class supports method chaining for convenient option configuration:
|
||||
* ```cpp
|
||||
* auto opts = WriterOptions().scale(5).addHRT(true);
|
||||
* ```
|
||||
*/
|
||||
class WriterOptions
|
||||
{
|
||||
struct Data;
|
||||
|
||||
std::unique_ptr<Data> d;
|
||||
|
||||
public:
|
||||
WriterOptions();
|
||||
~WriterOptions();
|
||||
WriterOptions(WriterOptions&&) noexcept;
|
||||
WriterOptions& operator=(WriterOptions&&) noexcept;
|
||||
|
||||
#define ZX_PROPERTY(TYPE, NAME) \
|
||||
TYPE NAME() const noexcept; \
|
||||
WriterOptions& NAME(TYPE v)&; \
|
||||
WriterOptions&& NAME(TYPE v)&&;
|
||||
|
||||
/// scale factor for rendering, ie the module size (default: 1). Passing a negative value will choose the scale
|
||||
/// automatically to fit the size of the barcode to abs(scale) as close as possible.
|
||||
ZX_PROPERTY(int, scale)
|
||||
|
||||
/// rotate the barcode by given degrees (0, 90, 180, 270)
|
||||
ZX_PROPERTY(int, rotate)
|
||||
|
||||
/// invert the colors of the barcode
|
||||
ZX_PROPERTY(bool, invert)
|
||||
|
||||
/// add human readable text (HRI) to the barcode
|
||||
ZX_PROPERTY(bool, addHRT)
|
||||
|
||||
/// add quiet zones around the barcode (default: true)
|
||||
ZX_PROPERTY(bool, addQuietZones)
|
||||
|
||||
#undef ZX_PROPERTY
|
||||
};
|
||||
|
||||
|
||||
/// Write barcode symbol to SVG
|
||||
std::string WriteBarcodeToSVG(const Barcode& barcode, const WriterOptions& options = {});
|
||||
|
||||
/// Write barcode symbol to a utf8 string using graphical characters (e.g. '▀')
|
||||
std::string WriteBarcodeToUtf8(const Barcode& barcode, const WriterOptions& options = {});
|
||||
|
||||
/// Write barcode symbol to Image (Bitmap)
|
||||
Image WriteBarcodeToImage(const Barcode& barcode, const WriterOptions& options = {});
|
||||
|
||||
} // ZXing
|
||||
Reference in new issue
Block a user