1 package com.tomgibara.android.camera;
\r
3 import android.graphics.Canvas;
\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
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
14 * @author Tom Gibara
\r
17 public interface CameraSource {
\r
19 String LOG_TAG = "camera";
\r
22 * Open the camera source for subsequent use via calls to capture().
\r
24 * @return true if the camera source was successfully opened.
\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
38 * The width of the captured image.
\r
40 * @return the width of the capture in pixels
\r
46 * The height of the captured image.
\r
48 * @return the height of the capture in pixels
\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
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
62 boolean capture(Canvas canvas);
\r