OLD | NEW |
| (Empty) |
1 // 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 | |
7 #include "barcode.h" | |
8 #include "include/BC_Writer.h" | |
9 CBC_Writer::CBC_Writer() | |
10 { | |
11 m_CharEncoding = 0; | |
12 m_ModuleHeight = 1; | |
13 m_ModuleWidth = 1; | |
14 m_Height = 320; | |
15 m_Width = 640; | |
16 m_colorSpace = FXDIB_Argb; | |
17 m_barColor = 0xff000000; | |
18 m_backgroundColor = 0xffffffff; | |
19 } | |
20 CBC_Writer::~CBC_Writer() | |
21 { | |
22 } | |
23 FX_BOOL CBC_Writer::SetCharEncoding(FX_INT32 encoding) | |
24 { | |
25 m_CharEncoding = encoding; | |
26 return TRUE; | |
27 } | |
28 FX_BOOL CBC_Writer::SetModuleHeight(FX_INT32 moduleHeight) | |
29 { | |
30 if (moduleHeight > 10 || moduleHeight < 1) { | |
31 return FALSE; | |
32 } | |
33 m_ModuleHeight = moduleHeight; | |
34 return TRUE; | |
35 } | |
36 FX_BOOL CBC_Writer::SetModuleWidth(FX_INT32 moduleWidth) | |
37 { | |
38 if ( moduleWidth > 10 || moduleWidth < 1) { | |
39 return FALSE; | |
40 } | |
41 m_ModuleWidth = moduleWidth; | |
42 return TRUE; | |
43 } | |
44 FX_BOOL CBC_Writer::SetHeight(FX_INT32 height) | |
45 { | |
46 m_Height = height; | |
47 return TRUE; | |
48 } | |
49 FX_BOOL CBC_Writer::SetWidth(FX_INT32 width) | |
50 { | |
51 m_Width = width; | |
52 return TRUE; | |
53 } | |
54 void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) | |
55 { | |
56 m_backgroundColor = backgroundColor; | |
57 } | |
58 void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) | |
59 { | |
60 m_barColor = foregroundColor; | |
61 } | |
62 CFX_DIBitmap* CBC_Writer::CreateDIBitmap(FX_INT32 width, FX_INT32 height) | |
63 { | |
64 CFX_DIBitmap *pDIBitmap = NULL; | |
65 pDIBitmap = FX_NEW CFX_DIBitmap; | |
66 if(pDIBitmap != NULL) { | |
67 pDIBitmap->Create(width, height, m_colorSpace); | |
68 } | |
69 return pDIBitmap; | |
70 } | |
OLD | NEW |