Issue 489 update the port
[zxing.git] / cpp / core / src / zxing / BinaryBitmap.cpp
1 /*
2  *  BinaryBitmap.cpp
3  *  zxing
4  *
5  *  Copyright 2010 ZXing authors All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <zxing/BinaryBitmap.h>
21
22 namespace zxing {
23         
24         BinaryBitmap::BinaryBitmap(Ref<Binarizer> binarizer) : binarizer_(binarizer) {
25                 
26         }
27         
28         BinaryBitmap::~BinaryBitmap() {
29         }
30         
31         Ref<BitArray> BinaryBitmap::getBlackRow(int y, Ref<BitArray> row) {
32                 return binarizer_->getBlackRow(y, row);
33         }
34         
35         Ref<BitMatrix> BinaryBitmap::getBlackMatrix() {
36                 return binarizer_->getBlackMatrix();
37         }
38         
39         int BinaryBitmap::getWidth() const {
40                 return getLuminanceSource()->getWidth();
41         }
42         
43         int BinaryBitmap::getHeight() const {
44                 return getLuminanceSource()->getHeight();
45         }
46         
47         Ref<LuminanceSource> BinaryBitmap::getLuminanceSource() const {
48                 return binarizer_->getLuminanceSource();
49         }
50         
51
52         bool BinaryBitmap::isCropSupported() const {
53           return getLuminanceSource()->isCropSupported();
54         }
55
56         Ref<BinaryBitmap> BinaryBitmap::crop(int left, int top, int width, int height) {
57           return Ref<BinaryBitmap> (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->crop(left, top, width, height))));
58         }
59
60         bool BinaryBitmap::isRotateSupported() const {
61           return getLuminanceSource()->isRotateSupported();
62         }
63
64         Ref<BinaryBitmap> BinaryBitmap::rotateCounterClockwise() {
65           return Ref<BinaryBitmap> (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->rotateCounterClockwise())));
66         }
67 }