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 // Original code is licensed as follows: | |
7 /* | |
8 * Copyright 2009 ZXing authors | |
9 * | |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | |
11 * you may not use this file except in compliance with the License. | |
12 * You may obtain a copy of the License at | |
13 * | |
14 * http://www.apache.org/licenses/LICENSE-2.0 | |
15 * | |
16 * Unless required by applicable law or agreed to in writing, software | |
17 * distributed under the License is distributed on an "AS IS" BASIS, | |
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
19 * See the License for the specific language governing permissions and | |
20 * limitations under the License. | |
21 */ | |
22 | |
23 #include "barcode.h" | |
24 #include "include/BC_Binarizer.h" | |
25 #include "include/BC_LuminanceSource.h" | |
26 #include "include/BC_CommonBitMatrix.h" | |
27 #include "include/BC_CommonBitArray.h" | |
28 #include "include/BC_BinaryBitmap.h" | |
29 CBC_BinaryBitmap::CBC_BinaryBitmap(CBC_Binarizer *binarizer): m_binarizer(binari
zer), m_matrix(NULL) | |
30 { | |
31 } | |
32 CBC_BinaryBitmap::~CBC_BinaryBitmap() | |
33 { | |
34 if (m_matrix != NULL) { | |
35 delete m_matrix; | |
36 } | |
37 m_matrix = NULL; | |
38 } | |
39 FX_INT32 CBC_BinaryBitmap::GetHeight() | |
40 { | |
41 return m_binarizer->GetLuminanceSource()->GetHeight(); | |
42 } | |
43 FX_INT32 CBC_BinaryBitmap::GetWidth() | |
44 { | |
45 return m_binarizer->GetLuminanceSource()->GetWidth(); | |
46 } | |
47 CBC_CommonBitMatrix *CBC_BinaryBitmap::GetMatrix(FX_INT32 &e) | |
48 { | |
49 if (m_matrix == NULL) { | |
50 m_matrix = m_binarizer->GetBlackMatrix(e); | |
51 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
52 } | |
53 return m_matrix; | |
54 } | |
55 FX_BOOL CBC_BinaryBitmap::IsCropSupported() | |
56 { | |
57 return m_binarizer->GetLuminanceSource()->IsCropSupported(); | |
58 } | |
59 FX_BOOL CBC_BinaryBitmap::IsRotateSupported() | |
60 { | |
61 return m_binarizer->GetLuminanceSource()->IsRotateSupported(); | |
62 } | |
63 CBC_CommonBitArray *CBC_BinaryBitmap::GetBlackRow(FX_INT32 y, CBC_CommonBitArray
*row, FX_INT32 &e) | |
64 { | |
65 CBC_CommonBitArray *temp = m_binarizer->GetBlackRow(y, row, e); | |
66 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
67 return temp; | |
68 } | |
69 CBC_CommonBitMatrix *CBC_BinaryBitmap::GetBlackMatrix(FX_INT32 &e) | |
70 { | |
71 if (m_matrix == NULL) { | |
72 m_matrix = m_binarizer->GetBlackMatrix(e); | |
73 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
74 } | |
75 return m_matrix; | |
76 } | |
OLD | NEW |