1 // Copyright 2014 The PDFium Authors 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 FXBARCODE_CFX_BARCODE_H_ 8 #define FXBARCODE_CFX_BARCODE_H_ 9 10 #include <stdint.h> 11 12 #include <memory> 13 14 #include "core/fxcrt/widestring.h" 15 #include "core/fxge/dib/fx_dib.h" 16 #include "fxbarcode/BC_Library.h" 17 18 class CBC_CodeBase; 19 class CFX_Font; 20 class CFX_RenderDevice; 21 class CFX_Matrix; 22 23 class CFX_Barcode { 24 public: 25 ~CFX_Barcode(); 26 27 static std::unique_ptr<CFX_Barcode> Create(BC_TYPE type); 28 BC_TYPE GetType(); 29 bool Encode(WideStringView contents); 30 31 bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix& matrix); 32 33 void SetCharEncoding(BC_CHAR_ENCODING encoding); 34 bool SetModuleHeight(int32_t moduleHeight); 35 bool SetModuleWidth(int32_t moduleWidth); 36 void SetHeight(int32_t height); 37 void SetWidth(int32_t width); 38 39 bool SetPrintChecksum(bool checksum); 40 bool SetDataLength(int32_t length); 41 bool SetCalChecksum(bool state); 42 43 bool SetFont(CFX_Font* pFont); 44 bool SetFontSize(float size); 45 bool SetFontColor(FX_ARGB color); 46 47 void SetTextLocation(BC_TEXT_LOC location); 48 bool SetWideNarrowRatio(int8_t ratio); 49 bool SetStartChar(char start); 50 bool SetEndChar(char end); 51 bool SetErrorCorrectionLevel(int32_t level); 52 53 private: 54 CFX_Barcode(); 55 56 std::unique_ptr<CBC_CodeBase> m_pBCEngine; 57 }; 58 59 #endif // FXBARCODE_CFX_BARCODE_H_ 60