xref: /aosp_15_r20/external/pdfium/fxbarcode/cfx_barcode.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2014 The PDFium Authors
2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file.
4*3ac0a46fSAndroid Build Coastguard Worker 
5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6*3ac0a46fSAndroid Build Coastguard Worker 
7*3ac0a46fSAndroid Build Coastguard Worker #ifndef FXBARCODE_CFX_BARCODE_H_
8*3ac0a46fSAndroid Build Coastguard Worker #define FXBARCODE_CFX_BARCODE_H_
9*3ac0a46fSAndroid Build Coastguard Worker 
10*3ac0a46fSAndroid Build Coastguard Worker #include <stdint.h>
11*3ac0a46fSAndroid Build Coastguard Worker 
12*3ac0a46fSAndroid Build Coastguard Worker #include <memory>
13*3ac0a46fSAndroid Build Coastguard Worker 
14*3ac0a46fSAndroid Build Coastguard Worker #include "core/fxcrt/widestring.h"
15*3ac0a46fSAndroid Build Coastguard Worker #include "core/fxge/dib/fx_dib.h"
16*3ac0a46fSAndroid Build Coastguard Worker #include "fxbarcode/BC_Library.h"
17*3ac0a46fSAndroid Build Coastguard Worker 
18*3ac0a46fSAndroid Build Coastguard Worker class CBC_CodeBase;
19*3ac0a46fSAndroid Build Coastguard Worker class CFX_Font;
20*3ac0a46fSAndroid Build Coastguard Worker class CFX_RenderDevice;
21*3ac0a46fSAndroid Build Coastguard Worker class CFX_Matrix;
22*3ac0a46fSAndroid Build Coastguard Worker 
23*3ac0a46fSAndroid Build Coastguard Worker class CFX_Barcode {
24*3ac0a46fSAndroid Build Coastguard Worker  public:
25*3ac0a46fSAndroid Build Coastguard Worker   ~CFX_Barcode();
26*3ac0a46fSAndroid Build Coastguard Worker 
27*3ac0a46fSAndroid Build Coastguard Worker   static std::unique_ptr<CFX_Barcode> Create(BC_TYPE type);
28*3ac0a46fSAndroid Build Coastguard Worker   BC_TYPE GetType();
29*3ac0a46fSAndroid Build Coastguard Worker   bool Encode(WideStringView contents);
30*3ac0a46fSAndroid Build Coastguard Worker 
31*3ac0a46fSAndroid Build Coastguard Worker   bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix& matrix);
32*3ac0a46fSAndroid Build Coastguard Worker 
33*3ac0a46fSAndroid Build Coastguard Worker   void SetCharEncoding(BC_CHAR_ENCODING encoding);
34*3ac0a46fSAndroid Build Coastguard Worker   bool SetModuleHeight(int32_t moduleHeight);
35*3ac0a46fSAndroid Build Coastguard Worker   bool SetModuleWidth(int32_t moduleWidth);
36*3ac0a46fSAndroid Build Coastguard Worker   void SetHeight(int32_t height);
37*3ac0a46fSAndroid Build Coastguard Worker   void SetWidth(int32_t width);
38*3ac0a46fSAndroid Build Coastguard Worker 
39*3ac0a46fSAndroid Build Coastguard Worker   bool SetPrintChecksum(bool checksum);
40*3ac0a46fSAndroid Build Coastguard Worker   bool SetDataLength(int32_t length);
41*3ac0a46fSAndroid Build Coastguard Worker   bool SetCalChecksum(bool state);
42*3ac0a46fSAndroid Build Coastguard Worker 
43*3ac0a46fSAndroid Build Coastguard Worker   bool SetFont(CFX_Font* pFont);
44*3ac0a46fSAndroid Build Coastguard Worker   bool SetFontSize(float size);
45*3ac0a46fSAndroid Build Coastguard Worker   bool SetFontColor(FX_ARGB color);
46*3ac0a46fSAndroid Build Coastguard Worker 
47*3ac0a46fSAndroid Build Coastguard Worker   void SetTextLocation(BC_TEXT_LOC location);
48*3ac0a46fSAndroid Build Coastguard Worker   bool SetWideNarrowRatio(int8_t ratio);
49*3ac0a46fSAndroid Build Coastguard Worker   bool SetStartChar(char start);
50*3ac0a46fSAndroid Build Coastguard Worker   bool SetEndChar(char end);
51*3ac0a46fSAndroid Build Coastguard Worker   bool SetErrorCorrectionLevel(int32_t level);
52*3ac0a46fSAndroid Build Coastguard Worker 
53*3ac0a46fSAndroid Build Coastguard Worker  private:
54*3ac0a46fSAndroid Build Coastguard Worker   CFX_Barcode();
55*3ac0a46fSAndroid Build Coastguard Worker 
56*3ac0a46fSAndroid Build Coastguard Worker   std::unique_ptr<CBC_CodeBase> m_pBCEngine;
57*3ac0a46fSAndroid Build Coastguard Worker };
58*3ac0a46fSAndroid Build Coastguard Worker 
59*3ac0a46fSAndroid Build Coastguard Worker #endif  // FXBARCODE_CFX_BARCODE_H_
60