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