xref: /aosp_15_r20/external/pdfium/fxbarcode/cbc_onecode.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2016 The PDFium Authors
2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file.
4*3ac0a46fSAndroid Build Coastguard Worker 
5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6*3ac0a46fSAndroid Build Coastguard Worker /*
7*3ac0a46fSAndroid Build Coastguard Worker  * Copyright 2011 ZXing authors
8*3ac0a46fSAndroid Build Coastguard Worker  *
9*3ac0a46fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
10*3ac0a46fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
11*3ac0a46fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
12*3ac0a46fSAndroid Build Coastguard Worker  *
13*3ac0a46fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
14*3ac0a46fSAndroid Build Coastguard Worker  *
15*3ac0a46fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
16*3ac0a46fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
17*3ac0a46fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18*3ac0a46fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
19*3ac0a46fSAndroid Build Coastguard Worker  * limitations under the License.
20*3ac0a46fSAndroid Build Coastguard Worker  */
21*3ac0a46fSAndroid Build Coastguard Worker 
22*3ac0a46fSAndroid Build Coastguard Worker #include "fxbarcode/cbc_onecode.h"
23*3ac0a46fSAndroid Build Coastguard Worker 
24*3ac0a46fSAndroid Build Coastguard Worker #include <utility>
25*3ac0a46fSAndroid Build Coastguard Worker 
26*3ac0a46fSAndroid Build Coastguard Worker #include "fxbarcode/oned/BC_OneDimWriter.h"
27*3ac0a46fSAndroid Build Coastguard Worker 
CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter)28*3ac0a46fSAndroid Build Coastguard Worker CBC_OneCode::CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter)
29*3ac0a46fSAndroid Build Coastguard Worker     : CBC_CodeBase(std::move(pWriter)) {}
30*3ac0a46fSAndroid Build Coastguard Worker 
31*3ac0a46fSAndroid Build Coastguard Worker CBC_OneCode::~CBC_OneCode() = default;
32*3ac0a46fSAndroid Build Coastguard Worker 
SetPrintChecksum(bool checksum)33*3ac0a46fSAndroid Build Coastguard Worker void CBC_OneCode::SetPrintChecksum(bool checksum) {
34*3ac0a46fSAndroid Build Coastguard Worker   GetOneDimWriter()->SetPrintChecksum(checksum);
35*3ac0a46fSAndroid Build Coastguard Worker }
36*3ac0a46fSAndroid Build Coastguard Worker 
SetDataLength(int32_t length)37*3ac0a46fSAndroid Build Coastguard Worker void CBC_OneCode::SetDataLength(int32_t length) {
38*3ac0a46fSAndroid Build Coastguard Worker   GetOneDimWriter()->SetDataLength(length);
39*3ac0a46fSAndroid Build Coastguard Worker }
40*3ac0a46fSAndroid Build Coastguard Worker 
SetCalChecksum(bool calc)41*3ac0a46fSAndroid Build Coastguard Worker void CBC_OneCode::SetCalChecksum(bool calc) {
42*3ac0a46fSAndroid Build Coastguard Worker   GetOneDimWriter()->SetCalcChecksum(calc);
43*3ac0a46fSAndroid Build Coastguard Worker }
44*3ac0a46fSAndroid Build Coastguard Worker 
SetFont(CFX_Font * cFont)45*3ac0a46fSAndroid Build Coastguard Worker bool CBC_OneCode::SetFont(CFX_Font* cFont) {
46*3ac0a46fSAndroid Build Coastguard Worker   return GetOneDimWriter()->SetFont(cFont);
47*3ac0a46fSAndroid Build Coastguard Worker }
48*3ac0a46fSAndroid Build Coastguard Worker 
SetFontSize(float size)49*3ac0a46fSAndroid Build Coastguard Worker void CBC_OneCode::SetFontSize(float size) {
50*3ac0a46fSAndroid Build Coastguard Worker   GetOneDimWriter()->SetFontSize(size);
51*3ac0a46fSAndroid Build Coastguard Worker }
52*3ac0a46fSAndroid Build Coastguard Worker 
SetFontStyle(int32_t style)53*3ac0a46fSAndroid Build Coastguard Worker void CBC_OneCode::SetFontStyle(int32_t style) {
54*3ac0a46fSAndroid Build Coastguard Worker   GetOneDimWriter()->SetFontStyle(style);
55*3ac0a46fSAndroid Build Coastguard Worker }
56*3ac0a46fSAndroid Build Coastguard Worker 
SetFontColor(FX_ARGB color)57*3ac0a46fSAndroid Build Coastguard Worker void CBC_OneCode::SetFontColor(FX_ARGB color) {
58*3ac0a46fSAndroid Build Coastguard Worker   GetOneDimWriter()->SetFontColor(color);
59*3ac0a46fSAndroid Build Coastguard Worker }
60*3ac0a46fSAndroid Build Coastguard Worker 
GetOneDimWriter()61*3ac0a46fSAndroid Build Coastguard Worker CBC_OneDimWriter* CBC_OneCode::GetOneDimWriter() {
62*3ac0a46fSAndroid Build Coastguard Worker   return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get());
63*3ac0a46fSAndroid Build Coastguard Worker }
64