• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
8 #define XFA_FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
9 
10 #include "core/fxcrt/fx_string.h"
11 #include "core/fxcrt/fx_system.h"
12 #include "xfa/fxbarcode/BC_Library.h"
13 #include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
14 
15 class CFX_DIBitmap;
16 class CFX_RenderDevice;
17 
18 class CBC_OnedEAN8Writer : public CBC_OneDimWriter {
19  public:
20   CBC_OnedEAN8Writer();
21   ~CBC_OnedEAN8Writer() override;
22 
23   // CBC_OneDimWriter
24   uint8_t* Encode(const CFX_ByteString& contents,
25                   BCFORMAT format,
26                   int32_t& outWidth,
27                   int32_t& outHeight,
28                   int32_t& e) override;
29   uint8_t* Encode(const CFX_ByteString& contents,
30                   BCFORMAT format,
31                   int32_t& outWidth,
32                   int32_t& outHeight,
33                   int32_t hints,
34                   int32_t& e) override;
35   uint8_t* Encode(const CFX_ByteString& contents,
36                   int32_t& outLength,
37                   int32_t& e) override;
38 
39   void RenderResult(const CFX_WideStringC& contents,
40                     uint8_t* code,
41                     int32_t codeLength,
42                     bool isDevice,
43                     int32_t& e) override;
44   bool CheckContentValidity(const CFX_WideStringC& contents) override;
45   CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
46   void SetDataLength(int32_t length) override;
47 
48   bool SetTextLocation(BC_TEXT_LOC location);
49   int32_t CalcChecksum(const CFX_ByteString& contents);
50 
51  protected:
52   void ShowChars(const CFX_WideStringC& contents,
53                  CFX_DIBitmap* pOutBitmap,
54                  CFX_RenderDevice* device,
55                  const CFX_Matrix* matrix,
56                  int32_t barWidth,
57                  int32_t multiple,
58                  int32_t& e) override;
59 
60  private:
61   int32_t m_codeWidth;
62 };
63 
64 #endif  // XFA_FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
65