K. Moon | 832a694 | 2022-10-31 20:11:31 +0000 | [diff] [blame] | 1 | // Copyright 2014 The PDFium Authors |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 7 | #ifndef FXBARCODE_BC_TWODIMWRITER_H_ |
| 8 | #define FXBARCODE_BC_TWODIMWRITER_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
weili | e76203d | 2016-08-09 13:45:03 -0700 | [diff] [blame] | 10 | #include <memory> |
| 11 | |
Nicolas Pena | 37cc5fb | 2017-04-04 12:12:49 -0400 | [diff] [blame] | 12 | #include "core/fxcrt/fx_coordinates.h" |
Lei Zhang | 3793595 | 2024-02-16 04:39:56 +0000 | [diff] [blame] | 13 | #include "core/fxcrt/span.h" |
Dan Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 14 | #include "fxbarcode/BC_Writer.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 15 | |
| 16 | class CBC_CommonBitMatrix; |
thestig | 25fa42f | 2016-05-25 21:39:46 -0700 | [diff] [blame] | 17 | class CFX_RenderDevice; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 18 | |
| 19 | class CBC_TwoDimWriter : public CBC_Writer { |
| 20 | public: |
Lei Zhang | 04bd91f | 2018-12-04 23:52:04 +0000 | [diff] [blame] | 21 | explicit CBC_TwoDimWriter(bool bFixedSize); |
weili | 29b8ad0 | 2016-06-14 18:20:04 -0700 | [diff] [blame] | 22 | ~CBC_TwoDimWriter() override; |
| 23 | |
Tom Sepez | 8a11888 | 2019-11-20 23:54:33 +0000 | [diff] [blame] | 24 | bool RenderResult(pdfium::span<const uint8_t> code, |
Lei Zhang | 176c0f8 | 2018-12-05 18:29:36 +0000 | [diff] [blame] | 25 | int32_t codeWidth, |
| 26 | int32_t codeHeight); |
Tom Sepez | c052ab0 | 2021-04-14 16:59:48 +0000 | [diff] [blame] | 27 | void RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix& matrix); |
Lei Zhang | 4c3b4aa | 2018-09-17 22:22:36 +0000 | [diff] [blame] | 28 | |
Lei Zhang | 04bd91f | 2018-12-04 23:52:04 +0000 | [diff] [blame] | 29 | int32_t error_correction_level() const { return m_iCorrectionLevel; } |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 30 | |
| 31 | protected: |
Lei Zhang | 04bd91f | 2018-12-04 23:52:04 +0000 | [diff] [blame] | 32 | void set_error_correction_level(int32_t level) { m_iCorrectionLevel = level; } |
Henrique Nakashima | dc2bb9a | 2018-08-21 19:50:17 +0000 | [diff] [blame] | 33 | |
| 34 | private: |
weili | e76203d | 2016-08-09 13:45:03 -0700 | [diff] [blame] | 35 | std::unique_ptr<CBC_CommonBitMatrix> m_output; |
Henrique Nakashima | dc2bb9a | 2018-08-21 19:50:17 +0000 | [diff] [blame] | 36 | int32_t m_multiX; |
| 37 | int32_t m_multiY; |
| 38 | int32_t m_leftPadding; |
| 39 | int32_t m_topPadding; |
| 40 | int32_t m_inputWidth; |
| 41 | int32_t m_inputHeight; |
| 42 | int32_t m_outputWidth; |
| 43 | int32_t m_outputHeight; |
Lei Zhang | 04bd91f | 2018-12-04 23:52:04 +0000 | [diff] [blame] | 44 | int32_t m_iCorrectionLevel = 1; |
| 45 | const bool m_bFixedSize; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 46 | }; |
| 47 | |
Dan Sinclair | e778668 | 2017-03-29 15:18:41 -0400 | [diff] [blame] | 48 | #endif // FXBARCODE_BC_TWODIMWRITER_H_ |