OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
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 | |
7 #ifndef XFA_SRC_FXBARCODE_ONED_BC_ONEDIMWRITER_H_ | |
8 #define XFA_SRC_FXBARCODE_ONED_BC_ONEDIMWRITER_H_ | |
9 | |
10 #include "core/include/fxge/fx_ge.h" | |
11 #include "xfa/include/fxbarcode/BC_BarCode.h" | |
12 #include "xfa/src/fxbarcode/BC_Writer.h" | |
13 | |
14 class CBC_CommonBitMatrix; | |
15 class CFX_Font; | |
16 class CFX_RenderDevice; | |
17 | |
18 class CBC_OneDimWriter : public CBC_Writer { | |
19 public: | |
20 CBC_OneDimWriter(); | |
21 virtual ~CBC_OneDimWriter(); | |
22 uint8_t* Encode(const CFX_ByteString& contents, | |
23 BCFORMAT format, | |
24 int32_t& outWidth, | |
25 int32_t& outHeight, | |
26 int32_t& e); | |
27 uint8_t* Encode(const CFX_ByteString& contents, | |
28 BCFORMAT format, | |
29 int32_t& outWidth, | |
30 int32_t& outHeight, | |
31 int32_t hints, | |
32 int32_t& e); | |
33 virtual uint8_t* Encode(const CFX_ByteString& contents, | |
34 int32_t& outLength, | |
35 int32_t& e) { | |
36 return NULL; | |
37 } | |
38 virtual void RenderResult(const CFX_WideStringC& contents, | |
39 uint8_t* code, | |
40 int32_t codeLength, | |
41 FX_BOOL isDevice, | |
42 int32_t& e); | |
43 virtual void RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, | |
44 const CFX_WideStringC& contents, | |
45 int32_t& e); | |
46 virtual void RenderDeviceResult(CFX_RenderDevice* device, | |
47 const CFX_Matrix* matrix, | |
48 const CFX_WideStringC& contents, | |
49 int32_t& e); | |
50 virtual FX_BOOL CheckContentValidity(const CFX_WideStringC& contents) { | |
51 return TRUE; | |
52 } | |
53 virtual CFX_WideString FilterContents(const CFX_WideStringC& contents) { | |
54 return CFX_WideString(); | |
55 } | |
56 virtual CFX_WideString RenderTextContents(const CFX_WideStringC& contents) { | |
57 return CFX_WideString(); | |
58 } | |
59 virtual void SetPrintChecksum(FX_BOOL checksum); | |
60 virtual void SetDataLength(int32_t length); | |
61 virtual void SetCalcChecksum(int32_t state); | |
62 virtual void SetFontSize(FX_FLOAT size); | |
63 virtual void SetFontStyle(int32_t style); | |
64 virtual void SetFontColor(FX_ARGB color); | |
65 virtual FX_BOOL SetFont(CFX_Font* cFont); | |
66 | |
67 protected: | |
68 FX_BOOL m_bPrintChecksum; | |
69 int32_t m_iDataLenth; | |
70 FX_BOOL m_bCalcChecksum; | |
71 CFX_Font* m_pFont; | |
72 FX_FLOAT m_fFontSize; | |
73 int32_t m_iFontStyle; | |
74 FX_DWORD m_fontColor; | |
75 BC_TEXT_LOC m_locTextLoc; | |
76 int32_t m_iContentLen; | |
77 FX_BOOL m_bLeftPadding; | |
78 FX_BOOL m_bRightPadding; | |
79 CBC_CommonBitMatrix* m_output; | |
80 int32_t m_barWidth; | |
81 int32_t m_multiple; | |
82 FX_FLOAT m_outputHScale; | |
83 void CalcTextInfo(const CFX_ByteString& text, | |
84 FXTEXT_CHARPOS* charPos, | |
85 CFX_Font* cFont, | |
86 FX_FLOAT geWidth, | |
87 int32_t fontSize, | |
88 FX_FLOAT& charsLen); | |
89 virtual void ShowChars(const CFX_WideStringC& contents, | |
90 CFX_DIBitmap* pOutBitmap, | |
91 CFX_RenderDevice* device, | |
92 const CFX_Matrix* matrix, | |
93 int32_t barWidth, | |
94 int32_t multiple, | |
95 int32_t& e); | |
96 virtual void ShowBitmapChars(CFX_DIBitmap* pOutBitmap, | |
97 const CFX_ByteString str, | |
98 FX_FLOAT geWidth, | |
99 FXTEXT_CHARPOS* pCharPos, | |
100 FX_FLOAT locX, | |
101 FX_FLOAT locY, | |
102 int32_t barWidth); | |
103 virtual void ShowDeviceChars(CFX_RenderDevice* device, | |
104 const CFX_Matrix* matrix, | |
105 const CFX_ByteString str, | |
106 FX_FLOAT geWidth, | |
107 FXTEXT_CHARPOS* pCharPos, | |
108 FX_FLOAT locX, | |
109 FX_FLOAT locY, | |
110 int32_t barWidth); | |
111 int32_t AppendPattern(uint8_t* target, | |
112 int32_t pos, | |
113 const int32_t* pattern, | |
114 int32_t patternLength, | |
115 int32_t startColor, | |
116 int32_t& e); | |
117 FX_WCHAR Upper(FX_WCHAR ch); | |
118 }; | |
119 | |
120 #endif // XFA_SRC_FXBARCODE_ONED_BC_ONEDIMWRITER_H_ | |
OLD | NEW |