blob: c8830e4adbc5fdc04e35d544fdeb174c25d16d7d [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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
Tom Sepezae5d92a2020-01-07 23:41:49 +00007#ifndef FXBARCODE_CFX_BARCODE_H_
8#define FXBARCODE_CFX_BARCODE_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
weili1b4f6b32016-08-04 16:37:48 -070010#include <memory>
11
dsinclaira52ab742016-09-29 13:59:29 -070012#include "core/fxcrt/fx_coordinates.h"
13#include "core/fxcrt/fx_string.h"
14#include "core/fxcrt/fx_system.h"
Tom Sepezcefb38d2020-10-20 19:08:33 +000015#include "core/fxge/dib/fx_dib.h"
Dan Sinclaire7786682017-03-29 15:18:41 -040016#include "fxbarcode/BC_Library.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040017
Dan Sinclaira98600a2016-03-21 15:15:56 -040018class CBC_CodeBase;
dsinclaireb9cf672016-04-13 10:14:26 -070019class CFX_Font;
20class CFX_RenderDevice;
21class CFX_Matrix;
Dan Sinclaira98600a2016-03-21 15:15:56 -040022
dsinclaireb9cf672016-04-13 10:14:26 -070023class CFX_Barcode {
Dan Sinclair1770c022016-03-14 14:14:16 -040024 public:
Dan Sinclair1770c022016-03-14 14:14:16 -040025 ~CFX_Barcode();
Dan Sinclaira98600a2016-03-21 15:15:56 -040026
Ryan Harrison4b9d6982018-01-26 17:11:51 +000027 static std::unique_ptr<CFX_Barcode> Create(BC_TYPE type);
dsinclaireb9cf672016-04-13 10:14:26 -070028 BC_TYPE GetType();
Tom Sepez1ab27572018-12-14 20:31:31 +000029 bool Encode(WideStringView contents);
dsinclair34398022016-11-14 15:13:11 -080030
Lei Zhang1badb852017-04-20 15:58:56 -070031 bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix);
dsinclair34398022016-11-14 15:13:11 -080032
tsepezd19e9122016-11-02 15:43:18 -070033 bool SetCharEncoding(BC_CHAR_ENCODING encoding);
dsinclair34398022016-11-14 15:13:11 -080034
tsepezd19e9122016-11-02 15:43:18 -070035 bool SetModuleHeight(int32_t moduleHeight);
36 bool SetModuleWidth(int32_t moduleWidth);
dsinclair34398022016-11-14 15:13:11 -080037
tsepezd19e9122016-11-02 15:43:18 -070038 bool SetHeight(int32_t height);
39 bool SetWidth(int32_t width);
dsinclair34398022016-11-14 15:13:11 -080040
tsepezd19e9122016-11-02 15:43:18 -070041 bool SetPrintChecksum(bool checksum);
42 bool SetDataLength(int32_t length);
43 bool SetCalChecksum(bool state);
dsinclair34398022016-11-14 15:13:11 -080044
tsepezd19e9122016-11-02 15:43:18 -070045 bool SetFont(CFX_Font* pFont);
Dan Sinclair05df0752017-03-14 14:43:42 -040046 bool SetFontSize(float size);
tsepezd19e9122016-11-02 15:43:18 -070047 bool SetFontColor(FX_ARGB color);
dsinclair34398022016-11-14 15:13:11 -080048
tsepezd19e9122016-11-02 15:43:18 -070049 bool SetTextLocation(BC_TEXT_LOC location);
dsinclair34398022016-11-14 15:13:11 -080050
Lei Zhang1badb852017-04-20 15:58:56 -070051 bool SetWideNarrowRatio(int8_t ratio);
Dan Sinclair812e96c2017-03-13 16:43:37 -040052 bool SetStartChar(char start);
53 bool SetEndChar(char end);
tsepezd19e9122016-11-02 15:43:18 -070054 bool SetErrorCorrectionLevel(int32_t level);
Dan Sinclair1770c022016-03-14 14:14:16 -040055
dsinclair34398022016-11-14 15:13:11 -080056 private:
Ryan Harrison4b9d6982018-01-26 17:11:51 +000057 CFX_Barcode();
58
weili1b4f6b32016-08-04 16:37:48 -070059 std::unique_ptr<CBC_CodeBase> m_pBCEngine;
Dan Sinclair1770c022016-03-14 14:14:16 -040060};
61
Tom Sepezae5d92a2020-01-07 23:41:49 +000062#endif // FXBARCODE_CFX_BARCODE_H_