- u_async.c: process immediate_queue BEFORE epoll_wait in uasync_poll - stcp_link.c: defensive NULL etcp_conn/etcp_link in stcp_link_close - utun_instance.c: move stcp_server_list_destroy_all to Phase J (before ETCP), add deferred drain in both Phase J and L - stcp.h/c: STCP_HS_ENC_CLIENT 6→38, STCP_HS_ENC_SERVER 7→39, exchange ed25519_pubkey in both handshake directions - etcp_connections.c: copy peer_ed25519 from STCP to ETCP_CONN in etcp_link_enter_ready_tcp; guard link->etcp in tcp_link_close_cb - chat_sync.c: fix lk->conn NULL dereference for TCP links - test_stcp.c: update stcp_server_create/stcp_client_connect callsites - tools/chat_tcp_test: change transport udp→tcp
73 lines
1.8 KiB
C++
73 lines
1.8 KiB
C++
/*
|
|
* 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
|