5 * Copyright 2010 ZXing authors All rights reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <zxing/BinaryBitmap.h>
24 BinaryBitmap::BinaryBitmap(Ref<Binarizer> binarizer) : binarizer_(binarizer) {
28 BinaryBitmap::~BinaryBitmap() {
31 Ref<BitArray> BinaryBitmap::getBlackRow(int y, Ref<BitArray> row) {
32 return binarizer_->getBlackRow(y, row);
35 Ref<BitMatrix> BinaryBitmap::getBlackMatrix() {
36 return binarizer_->getBlackMatrix();
39 int BinaryBitmap::getWidth() const {
40 return getLuminanceSource()->getWidth();
43 int BinaryBitmap::getHeight() const {
44 return getLuminanceSource()->getHeight();
47 Ref<LuminanceSource> BinaryBitmap::getLuminanceSource() const {
48 return binarizer_->getLuminanceSource();
52 bool BinaryBitmap::isCropSupported() const {
53 return getLuminanceSource()->isCropSupported();
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))));
60 bool BinaryBitmap::isRotateSupported() const {
61 return getLuminanceSource()->isRotateSupported();
64 Ref<BinaryBitmap> BinaryBitmap::rotateCounterClockwise() {
65 return Ref<BinaryBitmap> (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->rotateCounterClockwise())));