Per dominik.wild, added support for "sms:number:body" format URIs
[zxing.git] / android / src / com / tomgibara / android / camera / CameraSource.java
1 package com.tomgibara.android.camera;\r
2 \r
3 import android.graphics.Canvas;\r
4 \r
5 // This is public-domain code generously supplied to the developer community\r
6 // by Tom Gibara, at http://www.tomgibara.com/android/camera-source\r
7 \r
8 /**\r
9  * Provides a simple abstraction for obtaining preview captures from a camera\r
10  * on the Android platform. This interface intended to be used temporarily while\r
11  * the Google Android SDK fails to support camera capture from desktop devices\r
12  * (webcams etc).\r
13  * \r
14  * @author Tom Gibara\r
15  */\r
16 \r
17 public interface CameraSource {\r
18 \r
19         String LOG_TAG = "camera";\r
20         \r
21         /**\r
22          * Open the camera source for subsequent use via calls to capture().\r
23          * \r
24          * @return true if the camera source was successfully opened.\r
25          */\r
26         \r
27         boolean open();\r
28         \r
29         /**\r
30          * Close the camera source. Calling close on a closed CameraSource is\r
31          * permitted but has no effect. The camera source may be reopened after\r
32          * being closed.\r
33          */\r
34         \r
35         void close();\r
36         \r
37         /**\r
38          * The width of the captured image.\r
39          * \r
40          * @return the width of the capture in pixels\r
41          */\r
42         \r
43         int getWidth();\r
44         \r
45         /**\r
46          * The height of the captured image.\r
47          * \r
48          * @return the height of the capture in pixels\r
49          */\r
50         \r
51         int getHeight();\r
52         \r
53         /**\r
54          * Attempts to render the current camera view onto the supplied canvas.\r
55          * The capture will be rendered into the rectangle (0,0,width,height).\r
56          * Outstanding transformations on the canvas may alter this.\r
57          * \r
58          * @param canvas the canvas to which the captured pixel data will be written\r
59          * @return true iff a frame was successfully written to the canvas\r
60          */\r
61         \r
62         boolean capture(Canvas canvas);\r
63         \r
64 }\r