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 {
30 BaseLuminanceSource(int width, int height) {
35 * Requests the width of the underlying platform's bitmap.
37 * @return The width in pixels.
39 public abstract int getDataWidth();
42 * Requests the height of the underlying platform's bitmap.
44 * @return The height in pixels.
46 public abstract int getDataHeight();
49 * Creates a greyscale Android Bitmap from the YUV data based on the crop rectangle.
51 * @return An 8888 bitmap.
53 public abstract Bitmap renderCroppedGreyscaleBitmap();
56 * Creates a color Android Bitmap from the YUV data, ignoring the crop rectangle.
58 * @param halfSize If true, downsample to 50% in each dimension, otherwise not.
59 * @return An 8888 bitmap.
61 public abstract Bitmap renderFullColorBitmap(boolean halfSize);