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 FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_ 8 #define FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_ 9 10 #include "core/fxcrt/fx_string.h" 11 #include "core/fxcrt/fx_system.h" 12 #include "fxbarcode/BC_Library.h" 13 #include "fxbarcode/oned/BC_OnedEANWriter.h" 14 15 class CFX_DIBitmap; 16 class CFX_RenderDevice; 17 18 class CBC_OnedEAN8Writer final : public CBC_OneDimEANWriter { 19 public: 20 CBC_OnedEAN8Writer(); 21 ~CBC_OnedEAN8Writer() override; 22 23 // CBC_OneDimEANWriter: 24 uint8_t* EncodeWithHint(const ByteString& contents, 25 BCFORMAT format, 26 int32_t& outWidth, 27 int32_t& outHeight, 28 int32_t hints) override; 29 uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override; 30 bool CheckContentValidity(WideStringView contents) override; 31 WideString FilterContents(WideStringView contents) override; 32 void SetDataLength(int32_t length) override; 33 bool SetTextLocation(BC_TEXT_LOC location) override; 34 int32_t CalcChecksum(const ByteString& contents) override; 35 36 private: 37 bool ShowChars(WideStringView contents, 38 CFX_RenderDevice* device, 39 const CFX_Matrix* matrix, 40 int32_t barWidth, 41 int32_t multiple) override; 42 43 static constexpr int32_t kDefaultCodeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3; 44 int32_t m_codeWidth = kDefaultCodeWidth; 45 }; 46 47 #endif // FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_ 48