8
9
10
11
12
13
14
15
16
17
18
19
20
21
23#include "fxbarcode/pdf417/BC_PDF417Writer.h"
30#include "core/fxcrt/data_vector.h"
31#include "core/fxcrt/stl_util.h"
32#include "fxbarcode/BC_TwoDimWriter.h"
33#include "fxbarcode/pdf417/BC_PDF417.h"
34#include "fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
38void RotateArray(DataVector<uint8_t>& bitarray, int32_t width, int32_t height) {
39 DataVector<uint8_t> temp = bitarray;
40 for (int32_t i = 0; i < height; i++) {
41 int32_t inverse_i = height - i - 1;
42 for (int32_t j = 0; j < width; j++) {
43 bitarray[j * height + inverse_i] = temp[i * width + j];
55 if (level < 0 || level > 8) {
67 if (row >= 3 && row <= 90 && col >= 1 && col <= 30)
69 else if (col >= 1 && col <= 30)
71 else if (row >= 3 && row <= 90)
74 return {DataVector<uint8_t>(), 0, 0};
78 DataVector<uint8_t> matrix_data = barcodeMatrix->toBitArray();
79 int32_t matrix_width = barcodeMatrix->getWidth();
80 int32_t matrix_height = barcodeMatrix->getHeight();
82 if (matrix_width < matrix_height) {
83 RotateArray(matrix_data, matrix_width, matrix_height);
84 std::swap(matrix_width, matrix_height);
86 return {
std::move(matrix_data), matrix_width, matrix_height};
89CBC_PDF417Writer::
EncodeResult::EncodeResult(DataVector<uint8_t> data,
92 : data(std::move(data)),
width(width),
height(height) {}
~CBC_PDF417Writer() override
EncodeResult Encode(WideStringView contents) const
bool SetErrorCorrectionLevel(int32_t level) override
void setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, int32_t minRows)
bool GenerateBarcodeLogic(WideStringView msg, int32_t errorCorrectionLevel)
CBC_BarcodeMatrix * getBarcodeMatrix()
int32_t error_correction_level() const
void set_error_correction_level(int32_t level)
CBC_TwoDimWriter(bool bFixedSize)
fxcrt::WideStringView WideStringView