OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXBARCODE_CBC_CODEBASE_H_ | 7 #ifndef XFA_FXBARCODE_CBC_CODEBASE_H_ |
8 #define XFA_FXBARCODE_CBC_CODEBASE_H_ | 8 #define XFA_FXBARCODE_CBC_CODEBASE_H_ |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "core/fxcrt/include/fx_system.h" | 12 #include "core/fxcrt/include/fx_system.h" |
11 #include "core/fxge/include/fx_dib.h" | 13 #include "core/fxge/include/fx_dib.h" |
12 #include "xfa/fxbarcode/include/BC_Library.h" | 14 #include "xfa/fxbarcode/include/BC_Library.h" |
13 | 15 |
14 class CBC_Writer; | 16 class CBC_Writer; |
15 class CBC_Reader; | 17 class CBC_Reader; |
16 class CFX_DIBitmap; | 18 class CFX_DIBitmap; |
17 class CFX_RenderDevice; | 19 class CFX_RenderDevice; |
18 | 20 |
19 class CBC_CodeBase { | 21 class CBC_CodeBase { |
20 public: | 22 public: |
21 CBC_CodeBase(); | 23 CBC_CodeBase(CBC_Reader* pReader, CBC_Writer* pWriter); |
22 virtual ~CBC_CodeBase(); | 24 virtual ~CBC_CodeBase(); |
23 | 25 |
24 virtual BC_TYPE GetType() = 0; | 26 virtual BC_TYPE GetType() = 0; |
25 virtual FX_BOOL Encode(const CFX_WideStringC& contents, | 27 virtual FX_BOOL Encode(const CFX_WideStringC& contents, |
26 FX_BOOL isDevice, | 28 FX_BOOL isDevice, |
27 int32_t& e) = 0; | 29 int32_t& e) = 0; |
28 virtual FX_BOOL RenderDevice(CFX_RenderDevice* device, | 30 virtual FX_BOOL RenderDevice(CFX_RenderDevice* device, |
29 const CFX_Matrix* matrix, | 31 const CFX_Matrix* matrix, |
30 int32_t& e) = 0; | 32 int32_t& e) = 0; |
31 virtual FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0; | 33 virtual FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0; |
32 virtual CFX_WideString Decode(uint8_t* buf, | 34 virtual CFX_WideString Decode(uint8_t* buf, |
33 int32_t width, | 35 int32_t width, |
34 int32_t height, | 36 int32_t height, |
35 int32_t& e) = 0; | 37 int32_t& e) = 0; |
36 virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) = 0; | 38 virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) = 0; |
37 | 39 |
38 virtual FX_BOOL SetCharEncoding(int32_t encoding); | 40 FX_BOOL SetCharEncoding(int32_t encoding); |
39 virtual FX_BOOL SetModuleHeight(int32_t moduleHeight); | 41 FX_BOOL SetModuleHeight(int32_t moduleHeight); |
40 virtual FX_BOOL SetModuleWidth(int32_t moduleWidth); | 42 FX_BOOL SetModuleWidth(int32_t moduleWidth); |
41 | 43 FX_BOOL SetHeight(int32_t height); |
42 virtual FX_BOOL SetHeight(int32_t height); | 44 FX_BOOL SetWidth(int32_t width); |
43 virtual FX_BOOL SetWidth(int32_t width); | 45 void SetBackgroundColor(FX_ARGB backgroundColor); |
44 virtual void SetBackgroundColor(FX_ARGB backgroundColor); | 46 void SetBarcodeColor(FX_ARGB foregroundColor); |
45 virtual void SetBarcodeColor(FX_ARGB foregroundColor); | |
46 | 47 |
47 protected: | 48 protected: |
48 CBC_Writer* m_pBCWriter; | 49 std::unique_ptr<CBC_Reader> m_pBCReader; |
49 CBC_Reader* m_pBCReader; | 50 std::unique_ptr<CBC_Writer> m_pBCWriter; |
50 }; | 51 }; |
51 | 52 |
52 #endif // XFA_FXBARCODE_CBC_CODEBASE_H_ | 53 #endif // XFA_FXBARCODE_CBC_CODEBASE_H_ |
OLD | NEW |