X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=cpp%2Fcore%2Fsrc%2Fzxing%2FBinaryBitmap.cpp;h=a1c68dbf47451a9dd7402a5cb2e13083b59817b6;hb=8269d7395274bc07fbdd98105c1bd7869365915d;hp=ff79b55d50f6bf43a5ced21307e1c2dd819a60a6;hpb=740a416a21701650a2953f27ab13ea55c585bf06;p=zxing.git diff --git a/cpp/core/src/zxing/BinaryBitmap.cpp b/cpp/core/src/zxing/BinaryBitmap.cpp index ff79b55d..a1c68dbf 100644 --- a/cpp/core/src/zxing/BinaryBitmap.cpp +++ b/cpp/core/src/zxing/BinaryBitmap.cpp @@ -2,9 +2,7 @@ * BinaryBitmap.cpp * zxing * - * Created by Ralf Kistner on 19/10/2009. - * Copyright 2008 ZXing authors All rights reserved. - * Modified by Lukasz Warchol on 02/02/2010. + * Copyright 2010 ZXing authors All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +21,7 @@ namespace zxing { - BinaryBitmap::BinaryBitmap(Ref binarizer) : bits_(NULL), array_bits_(NULL), binarizer_(binarizer), cached_y_(-1) { + BinaryBitmap::BinaryBitmap(Ref binarizer) : binarizer_(binarizer) { } @@ -31,28 +29,39 @@ namespace zxing { } Ref BinaryBitmap::getBlackRow(int y, Ref row) { - if (array_bits_ == NULL && cached_y_ != y) { - array_bits_ = binarizer_->getBlackRow(y, row); - cached_y_ = y; - } - return array_bits_; + return binarizer_->getBlackRow(y, row); } Ref BinaryBitmap::getBlackMatrix() { - if (bits_ == NULL) { - bits_ = binarizer_->getBlackMatrix(); - } - return bits_; + return binarizer_->getBlackMatrix(); } - int BinaryBitmap::getWidth() { - return getSource()->getWidth(); + + int BinaryBitmap::getWidth() const { + return getLuminanceSource()->getWidth(); } - int BinaryBitmap::getHeight() { - return getSource()->getHeight(); + + int BinaryBitmap::getHeight() const { + return getLuminanceSource()->getHeight(); } - Ref BinaryBitmap::getSource() { - return binarizer_->getSource(); + Ref BinaryBitmap::getLuminanceSource() const { + return binarizer_->getLuminanceSource(); } + + bool BinaryBitmap::isCropSupported() const { + return getLuminanceSource()->isCropSupported(); + } + + Ref BinaryBitmap::crop(int left, int top, int width, int height) { + return Ref (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->crop(left, top, width, height)))); + } + + bool BinaryBitmap::isRotateSupported() const { + return getLuminanceSource()->isRotateSupported(); + } + + Ref BinaryBitmap::rotateCounterClockwise() { + return Ref (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->rotateCounterClockwise()))); + } }