• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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 FXBARCODE_CBC_CODEBASE_H_
8 #define FXBARCODE_CBC_CODEBASE_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_string.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "core/fxge/fx_dib.h"
15 #include "fxbarcode/BC_Library.h"
16 
17 class CBC_Reader;
18 class CBC_Writer;
19 class CFX_DIBitmap;
20 class CFX_Matrix;
21 class CFX_RenderDevice;
22 
23 class CBC_CodeBase {
24  public:
25   explicit CBC_CodeBase(std::unique_ptr<CBC_Writer> pWriter);
26   virtual ~CBC_CodeBase();
27 
28   virtual BC_TYPE GetType() = 0;
29   virtual bool Encode(const WideStringView& contents) = 0;
30   virtual bool RenderDevice(CFX_RenderDevice* device,
31                             const CFX_Matrix* matrix) = 0;
32 
33   bool SetCharEncoding(int32_t encoding);
34   bool SetModuleHeight(int32_t moduleHeight);
35   bool SetModuleWidth(int32_t moduleWidth);
36   bool SetHeight(int32_t height);
37   bool SetWidth(int32_t width);
38   void SetBackgroundColor(FX_ARGB backgroundColor);
39   void SetBarcodeColor(FX_ARGB foregroundColor);
40 
41  protected:
42   std::unique_ptr<CBC_Writer> m_pBCWriter;
43 };
44 
45 #endif  // FXBARCODE_CBC_CODEBASE_H_
46