OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "barcode.h" | 7 #include "barcode.h" |
8 #include "BC_Writer.h" | 8 #include "BC_Writer.h" |
9 CBC_Writer::CBC_Writer() | 9 CBC_Writer::CBC_Writer() |
10 { | 10 { |
11 m_CharEncoding = 0; | 11 m_CharEncoding = 0; |
12 m_ModuleHeight = 1; | 12 m_ModuleHeight = 1; |
13 m_ModuleWidth = 1; | 13 m_ModuleWidth = 1; |
14 m_Height = 320; | 14 m_Height = 320; |
15 m_Width = 640; | 15 m_Width = 640; |
16 m_colorSpace = FXDIB_Argb; | 16 m_colorSpace = FXDIB_Argb; |
17 m_barColor = 0xff000000; | 17 m_barColor = 0xff000000; |
18 m_backgroundColor = 0xffffffff; | 18 m_backgroundColor = 0xffffffff; |
19 } | 19 } |
20 CBC_Writer::~CBC_Writer() | 20 CBC_Writer::~CBC_Writer() |
21 { | 21 { |
22 } | 22 } |
23 FX_BOOL CBC_Writer::SetCharEncoding(FX_INT32 encoding) | 23 FX_BOOL CBC_Writer::SetCharEncoding(int32_t encoding) |
24 { | 24 { |
25 m_CharEncoding = encoding; | 25 m_CharEncoding = encoding; |
26 return TRUE; | 26 return TRUE; |
27 } | 27 } |
28 FX_BOOL CBC_Writer::SetModuleHeight(FX_INT32 moduleHeight) | 28 FX_BOOL CBC_Writer::SetModuleHeight(int32_t moduleHeight) |
29 { | 29 { |
30 if (moduleHeight > 10 || moduleHeight < 1) { | 30 if (moduleHeight > 10 || moduleHeight < 1) { |
31 return FALSE; | 31 return FALSE; |
32 } | 32 } |
33 m_ModuleHeight = moduleHeight; | 33 m_ModuleHeight = moduleHeight; |
34 return TRUE; | 34 return TRUE; |
35 } | 35 } |
36 FX_BOOL CBC_Writer::SetModuleWidth(FX_INT32 moduleWidth) | 36 FX_BOOL CBC_Writer::SetModuleWidth(int32_t moduleWidth) |
37 { | 37 { |
38 if ( moduleWidth > 10 || moduleWidth < 1) { | 38 if ( moduleWidth > 10 || moduleWidth < 1) { |
39 return FALSE; | 39 return FALSE; |
40 } | 40 } |
41 m_ModuleWidth = moduleWidth; | 41 m_ModuleWidth = moduleWidth; |
42 return TRUE; | 42 return TRUE; |
43 } | 43 } |
44 FX_BOOL CBC_Writer::SetHeight(FX_INT32 height) | 44 FX_BOOL CBC_Writer::SetHeight(int32_t height) |
45 { | 45 { |
46 m_Height = height; | 46 m_Height = height; |
47 return TRUE; | 47 return TRUE; |
48 } | 48 } |
49 FX_BOOL CBC_Writer::SetWidth(FX_INT32 width) | 49 FX_BOOL CBC_Writer::SetWidth(int32_t width) |
50 { | 50 { |
51 m_Width = width; | 51 m_Width = width; |
52 return TRUE; | 52 return TRUE; |
53 } | 53 } |
54 void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) | 54 void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) |
55 { | 55 { |
56 m_backgroundColor = backgroundColor; | 56 m_backgroundColor = backgroundColor; |
57 } | 57 } |
58 void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) | 58 void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) |
59 { | 59 { |
60 m_barColor = foregroundColor; | 60 m_barColor = foregroundColor; |
61 } | 61 } |
62 CFX_DIBitmap* CBC_Writer::CreateDIBitmap(FX_INT32 width, FX_INT32 height) | 62 CFX_DIBitmap* CBC_Writer::CreateDIBitmap(int32_t width, int32_t height) |
63 { | 63 { |
64 CFX_DIBitmap *pDIBitmap = NULL; | 64 CFX_DIBitmap *pDIBitmap = NULL; |
65 pDIBitmap = FX_NEW CFX_DIBitmap; | 65 pDIBitmap = FX_NEW CFX_DIBitmap; |
66 if(pDIBitmap != NULL) { | 66 if(pDIBitmap != NULL) { |
67 pDIBitmap->Create(width, height, m_colorSpace); | 67 pDIBitmap->Create(width, height, m_colorSpace); |
68 } | 68 } |
69 return pDIBitmap; | 69 return pDIBitmap; |
70 } | 70 } |
OLD | NEW |