2 * GrayBytesMonochromeBitmapSource.cpp
5 * Created by Christian Brunschen on 03/06/2008.
6 * Copyright 2008 ZXing authors All rights reserved.
10 #include "GrayBytesMonochromeBitmapSource.h"
11 #include "ReaderException.h"
12 #include "TransformingMonochromeBitmapSource.h"
14 GrayBytesMonochromeBitmapSource::
15 GrayBytesMonochromeBitmapSource(const unsigned char *bytes,
19 : MonochromeBitmapSource(),
23 bytesPerRow_(bytesPerRow) { }
26 size_t GrayBytesMonochromeBitmapSource::getWidth() {
30 size_t GrayBytesMonochromeBitmapSource::getHeight() {
34 unsigned char GrayBytesMonochromeBitmapSource::getPixel(size_t x, size_t y) {
35 if (x >= width_ || y >= height_) {
36 throw new ReaderException("bitmap coordinate out of bounds");
38 size_t index = y * bytesPerRow_ + x;
42 // create a new bitmap source with the same data but rotated counter-clockwise
43 Ref<MonochromeBitmapSource>
44 GrayBytesMonochromeBitmapSource::rotateCounterClockwise() {
45 Ref<MonochromeBitmapSource> self(this);
46 Ref<MonochromeBitmapSource> result(new TMBS90(self, 1.0));
50 bool GrayBytesMonochromeBitmapSource::isRotateSupported() {