blob: c28c08b7e75c936ee0371fe5d50c88b2c83701ad [file] [log] [blame]
Dan Sinclaira98600a2016-03-21 15:15:56 -04001// 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 XFA_FXBARCODE_CBC_CODEBASE_H_
8#define XFA_FXBARCODE_CBC_CODEBASE_H_
9
tsepez52d78562016-06-06 12:57:44 -070010#include <memory>
11
dsinclaira52ab742016-09-29 13:59:29 -070012#include "core/fxcrt/fx_system.h"
dsinclair74a34fc2016-09-29 16:41:42 -070013#include "core/fxge/fx_dib.h"
dsinclair202ad722016-09-29 17:41:42 -070014#include "xfa/fxbarcode/BC_Library.h"
Dan Sinclaira98600a2016-03-21 15:15:56 -040015
16class CBC_Writer;
17class CBC_Reader;
18class CFX_DIBitmap;
19class CFX_RenderDevice;
20
21class CBC_CodeBase {
22 public:
dsinclaira2615342016-06-16 12:29:07 -070023 explicit CBC_CodeBase(CBC_Writer* pWriter);
Dan Sinclaira98600a2016-03-21 15:15:56 -040024 virtual ~CBC_CodeBase();
25
26 virtual BC_TYPE GetType() = 0;
tsepezd19e9122016-11-02 15:43:18 -070027 virtual bool Encode(const CFX_WideStringC& contents,
28 bool isDevice,
29 int32_t& e) = 0;
30 virtual bool RenderDevice(CFX_RenderDevice* device,
31 const CFX_Matrix* matrix,
32 int32_t& e) = 0;
33 virtual bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0;
Dan Sinclaira98600a2016-03-21 15:15:56 -040034
tsepezd19e9122016-11-02 15:43:18 -070035 bool SetCharEncoding(int32_t encoding);
36 bool SetModuleHeight(int32_t moduleHeight);
37 bool SetModuleWidth(int32_t moduleWidth);
38 bool SetHeight(int32_t height);
39 bool SetWidth(int32_t width);
tsepez52d78562016-06-06 12:57:44 -070040 void SetBackgroundColor(FX_ARGB backgroundColor);
41 void SetBarcodeColor(FX_ARGB foregroundColor);
Dan Sinclaira98600a2016-03-21 15:15:56 -040042
43 protected:
tsepez52d78562016-06-06 12:57:44 -070044 std::unique_ptr<CBC_Writer> m_pBCWriter;
Dan Sinclaira98600a2016-03-21 15:15:56 -040045};
46
47#endif // XFA_FXBARCODE_CBC_CODEBASE_H_