2 * Copyright 2009 ZXing authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.google.zxing.client.android;
19 import com.google.zxing.LuminanceSource;
21 import android.graphics.Bitmap;
24 * An extension of LuminanceSource which adds some Android-specific methods.
26 * @author dswitkin@google.com (Daniel Switkin)
28 public abstract class BaseLuminanceSource extends LuminanceSource {
29 public BaseLuminanceSource(int width, int height) {
34 * Requests the width of the underlying platform's bitmap.
36 * @return The width in pixels.
38 public abstract int getDataWidth();
41 * Requests the height of the underlying platform's bitmap.
43 * @return The height in pixels.
45 public abstract int getDataHeight();
48 * Creates a greyscale Android Bitmap from the YUV data based on the crop rectangle.
50 * @return An 8888 bitmap.
52 public abstract Bitmap renderCroppedGreyscaleBitmap();
55 * Creates a color Android Bitmap from the YUV data, ignoring the crop rectangle.
57 * @param halfSize If true, downsample to 50% in each dimension, otherwise not.
58 * @return An 8888 bitmap.
60 public abstract Bitmap renderFullColorBitmap(boolean halfSize);