blob: aab98da32b30ef3a0af13d9c9f1b7eb2d167204d [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
Dan Sinclaire7786682017-03-29 15:18:41 -04007#ifndef FXBARCODE_CBC_CODEBASE_H_
8#define FXBARCODE_CBC_CODEBASE_H_
Dan Sinclaira98600a2016-03-21 15:15:56 -04009
tsepez52d78562016-06-06 12:57:44 -070010#include <memory>
11
Dan Sinclairbcd1e702017-08-31 13:19:18 -040012#include "core/fxcrt/fx_string.h"
dsinclaira52ab742016-09-29 13:59:29 -070013#include "core/fxcrt/fx_system.h"
dsinclair74a34fc2016-09-29 16:41:42 -070014#include "core/fxge/fx_dib.h"
Dan Sinclaire7786682017-03-29 15:18:41 -040015#include "fxbarcode/BC_Library.h"
Dan Sinclaira98600a2016-03-21 15:15:56 -040016
Dan Sinclaira98600a2016-03-21 15:15:56 -040017class CBC_Reader;
Lei Zhang1badb852017-04-20 15:58:56 -070018class CBC_Writer;
Dan Sinclaira98600a2016-03-21 15:15:56 -040019class CFX_DIBitmap;
Lei Zhang1badb852017-04-20 15:58:56 -070020class CFX_Matrix;
Dan Sinclaira98600a2016-03-21 15:15:56 -040021class CFX_RenderDevice;
22
23class CBC_CodeBase {
24 public:
Tom Sepezea23e0a2017-05-01 14:24:19 -070025 explicit CBC_CodeBase(std::unique_ptr<CBC_Writer> pWriter);
Dan Sinclaira98600a2016-03-21 15:15:56 -040026 virtual ~CBC_CodeBase();
27
28 virtual BC_TYPE GetType() = 0;
Ryan Harrison275e2602017-09-18 14:23:18 -040029 virtual bool Encode(const WideStringView& contents) = 0;
tsepezd19e9122016-11-02 15:43:18 -070030 virtual bool RenderDevice(CFX_RenderDevice* device,
Lei Zhang1badb852017-04-20 15:58:56 -070031 const CFX_Matrix* matrix) = 0;
Dan Sinclaira98600a2016-03-21 15:15:56 -040032
tsepezd19e9122016-11-02 15:43:18 -070033 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);
tsepez52d78562016-06-06 12:57:44 -070038 void SetBackgroundColor(FX_ARGB backgroundColor);
39 void SetBarcodeColor(FX_ARGB foregroundColor);
Dan Sinclaira98600a2016-03-21 15:15:56 -040040
41 protected:
tsepez52d78562016-06-06 12:57:44 -070042 std::unique_ptr<CBC_Writer> m_pBCWriter;
Dan Sinclaira98600a2016-03-21 15:15:56 -040043};
44
Dan Sinclaire7786682017-03-29 15:18:41 -040045#endif // FXBARCODE_CBC_CODEBASE_H_