5 * Copyright 2008 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/LuminanceSource.h>
21 #include <zxing/common/IllegalArgumentException.h>
25 LuminanceSource::LuminanceSource() {
28 LuminanceSource::~LuminanceSource() {
31 unsigned char* LuminanceSource::getMatrix() {
32 int width = getWidth();
33 int height = getHeight();
34 unsigned char* matrix = new unsigned char[width * height];
35 unsigned char* row = new unsigned char[width];
36 for (int y = 0; y < height; y++) {
38 memcpy(&matrix[y * width], row, width);
44 bool LuminanceSource::isCropSupported() const {
48 Ref<LuminanceSource> LuminanceSource::crop(int left, int top, int width, int height) {
49 throw IllegalArgumentException("This luminance source does not support cropping.");
52 bool LuminanceSource::isRotateSupported() const {
56 Ref<LuminanceSource> LuminanceSource::rotateCounterClockwise() {
57 throw IllegalArgumentException("This luminance source does not support rotation.");