Add history feature; group some functionality into subpackages
[zxing.git] / android / src / com / google / zxing / client / android / BaseLuminanceSource.java
1 /*
2  * Copyright 2009 ZXing authors
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package com.google.zxing.client.android;
18
19 import com.google.zxing.LuminanceSource;
20
21 import android.graphics.Bitmap;
22
23 /**
24  * An extension of LuminanceSource which adds some Android-specific methods.
25  *
26  * @author dswitkin@google.com (Daniel Switkin)
27  */
28 public abstract class BaseLuminanceSource extends LuminanceSource {
29
30   BaseLuminanceSource(int width, int height) {
31     super(width, height);
32   }
33
34   /**
35    * Requests the width of the underlying platform's bitmap.
36    *
37    * @return The width in pixels.
38    */
39   public abstract int getDataWidth();
40
41   /**
42    * Requests the height of the underlying platform's bitmap.
43    *
44    * @return The height in pixels.
45    */
46   public abstract int getDataHeight();
47
48   /**
49    * Creates a greyscale Android Bitmap from the YUV data based on the crop rectangle.
50    *
51    * @return An 8888 bitmap.
52    */
53   public abstract Bitmap renderCroppedGreyscaleBitmap();
54
55   /**
56    * Creates a color Android Bitmap from the YUV data, ignoring the crop rectangle.
57    *
58    * @param halfSize If true, downsample to 50% in each dimension, otherwise not.
59    * @return An 8888 bitmap.
60    */
61   public abstract Bitmap renderFullColorBitmap(boolean halfSize);
62 }