8
9
10
11
12
13
14
15
16
17
18
19
20
21
23#include "fxbarcode/datamatrix/BC_DataMatrixWriter.h"
29#include "core/fxcrt/check.h"
30#include "core/fxcrt/data_vector.h"
31#include "fxbarcode/BC_TwoDimWriter.h"
32#include "fxbarcode/BC_Writer.h"
33#include "fxbarcode/common/BC_CommonByteMatrix.h"
34#include "fxbarcode/datamatrix/BC_ASCIIEncoder.h"
35#include "fxbarcode/datamatrix/BC_Base256Encoder.h"
36#include "fxbarcode/datamatrix/BC_C40Encoder.h"
37#include "fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
38#include "fxbarcode/datamatrix/BC_DefaultPlacement.h"
39#include "fxbarcode/datamatrix/BC_EdifactEncoder.h"
40#include "fxbarcode/datamatrix/BC_Encoder.h"
41#include "fxbarcode/datamatrix/BC_EncoderContext.h"
42#include "fxbarcode/datamatrix/BC_ErrorCorrection.h"
43#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
44#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
45#include "fxbarcode/datamatrix/BC_TextEncoder.h"
46#include "fxbarcode/datamatrix/BC_X12Encoder.h"
50std::unique_ptr<CBC_CommonByteMatrix> EncodeLowLevel(
51 CBC_DefaultPlacement* placement,
62 auto matrix =
std::make_unique<CBC_CommonByteMatrix>(width, height);
64 for (int32_t y = 0; y < symbolHeight; y++) {
68 for (int32_t x = 0; x < width; x++) {
69 matrix->Set(matrixX, matrixY, x % 2 == 0);
75 for (int32_t x = 0; x < symbolWidth; x++) {
77 matrix->Set(matrixX, matrixY,
true);
80 matrix->Set(matrixX, matrixY, placement
->GetBit(x
, y
));
83 matrix->Set(matrixX, matrixY, y % 2 == 0);
90 for (int32_t x = 0; x < width; x++) {
91 matrix->Set(matrixX, matrixY,
true);
113 int32_t* pOutHeight) {
115 if (encoded.IsEmpty())
116 return DataVector<uint8_t>();
119 CBC_SymbolInfo::Lookup(encoded.GetLength(),
false);
121 return DataVector<uint8_t>();
125 if (codewords.IsEmpty())
126 return DataVector<uint8_t>();
134 std::make_unique<CBC_DefaultPlacement>(codewords, width, height);
135 auto bytematrix = EncodeLowLevel(placement.get(), pSymbolInfo);
138 *pOutWidth = bytematrix->GetWidth();
139 *pOutHeight = bytematrix->GetHeight();
140 return bytematrix->TakeArray();
bool SetErrorCorrectionLevel(int32_t level) override
~CBC_DataMatrixWriter() override
DataVector< uint8_t > Encode(const WideString &contents, int32_t *pOutWidth, int32_t *pOutHeight)
bool GetBit(int32_t col, int32_t row) const
static WideString EncodeECC200(const WideString &codewords, const CBC_SymbolInfo *symbolInfo)
static WideString EncodeHighLevel(const WideString &msg)
int32_t GetSymbolDataHeight() const
int32_t GetSymbolWidth() const
int32_t GetSymbolHeight() const
int32_t matrix_height() const
int32_t GetSymbolDataWidth() const
int32_t matrix_width() const
void set_error_correction_level(int32_t level)
CBC_TwoDimWriter(bool bFixedSize)
fxcrt::WideString WideString