--- /dev/null
+package com.tomgibara.android.camera;\r
+\r
+import android.graphics.Canvas;\r
+\r
+/**\r
+ * Provides a simple abstraction for obtaining preview captures from a camera\r
+ * on the Android platform. This interface intended to be used temporarily while\r
+ * the Google Android SDK fails to support camera capture from desktop devices\r
+ * (webcams etc).\r
+ * \r
+ * @author Tom Gibara\r
+ */\r
+\r
+public interface CameraSource {\r
+\r
+ static final String LOG_TAG = "camera";\r
+ \r
+ /**\r
+ * Open the camera source for subsequent use via calls to capture().\r
+ * \r
+ * @return true if the camera source was successfully opened.\r
+ */\r
+ \r
+ boolean open();\r
+ \r
+ /**\r
+ * Close the camera source. Calling close on a closed CameraSource is\r
+ * permitted but has no effect. The camera source may be reopened after\r
+ * being closed.\r
+ */\r
+ \r
+ void close();\r
+ \r
+ /**\r
+ * The width of the captured image.\r
+ * \r
+ * @return the width of the capture in pixels\r
+ */\r
+ \r
+ int getWidth();\r
+ \r
+ /**\r
+ * The height of the captured image.\r
+ * \r
+ * @return the height of the capture in pixels\r
+ */\r
+ \r
+ int getHeight();\r
+ \r
+ /**\r
+ * Attempts to render the current camera view onto the supplied canvas.\r
+ * The capture will be rendered into the rectangle (0,0,width,height).\r
+ * Outstanding transformations on the canvas may alter this.\r
+ * \r
+ * @param canvas the canvas to which the captured pixel data will be written\r
+ * @return true iff a frame was successfully written to the canvas\r
+ */\r
+ \r
+ boolean capture(Canvas canvas);\r
+ \r
+}\r