summaryrefslogtreecommitdiff
path: root/fxbarcode/BC_Writer.cpp
blob: 8d639d3f019b3f5c9f13b52224c58f2a412fad6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "fxbarcode/BC_Writer.h"

CBC_Writer::CBC_Writer() = default;

CBC_Writer::~CBC_Writer() = default;

bool CBC_Writer::SetCharEncoding(int32_t encoding) {
  m_CharEncoding = encoding;
  return true;
}

bool CBC_Writer::SetModuleHeight(int32_t moduleHeight) {
  if (moduleHeight > 10 || moduleHeight < 1)
    return false;

  m_ModuleHeight = moduleHeight;
  return true;
}

bool CBC_Writer::SetModuleWidth(int32_t moduleWidth) {
  if (moduleWidth > 10 || moduleWidth < 1)
    return false;

  m_ModuleWidth = moduleWidth;
  return true;
}

bool CBC_Writer::SetHeight(int32_t height) {
  m_Height = height;
  return true;
}

bool CBC_Writer::SetWidth(int32_t width) {
  m_Width = width;
  return true;
}

void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) {
  m_backgroundColor = backgroundColor;
}

void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) {
  m_barColor = foregroundColor;
}

bool CBC_Writer::SetTextLocation(BC_TEXT_LOC location) {
  return false;
}

RetainPtr<CFX_DIBitmap> CBC_Writer::CreateDIBitmap(int32_t width,
                                                   int32_t height) {
  auto pDIBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
  pDIBitmap->Create(width, height, m_colorSpace);
  return pDIBitmap;
}