From: dswitkin Date: Fri, 11 Sep 2009 16:11:47 +0000 (+0000) Subject: Added some comments to public methods. X-Git-Url: http://git.rot13.org/?p=zxing.git;a=commitdiff_plain;h=e2a3a1e9df758964103c1edcc2076ac4598eec28 Added some comments to public methods. git-svn-id: http://zxing.googlecode.com/svn/trunk@1051 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- diff --git a/android/src/com/google/zxing/client/android/CameraManager.java b/android/src/com/google/zxing/client/android/CameraManager.java index 4198a604..3eaaded2 100755 --- a/android/src/com/google/zxing/client/android/CameraManager.java +++ b/android/src/com/google/zxing/client/android/CameraManager.java @@ -77,6 +77,9 @@ final class CameraManager { } }; + /** + * Autofocus callbacks arrive here, and are dispatched to the Handler which requested them. + */ private final Camera.AutoFocusCallback autoFocusCallback = new Camera.AutoFocusCallback() { public void onAutoFocus(boolean success, Camera camera) { if (autoFocusHandler != null) { @@ -88,12 +91,22 @@ final class CameraManager { } }; + /** + * Initializes this static object with the Context of the calling Activity. + * + * @param context The Activity which wants to use the camera. + */ public static void init(Context context) { if (cameraManager == null) { cameraManager = new CameraManager(context); } } + /** + * Gets the CameraManager singleton instance. + * + * @return A reference to the CameraManager singleton. + */ public static CameraManager get() { return cameraManager; } @@ -105,6 +118,12 @@ final class CameraManager { previewing = false; } + /** + * Opens the camera driver and initializes the hardware parameters. + * + * @param holder The surface object which the camera will draw preview frames into. + * @throws IOException Indicates the camera driver failed to open. + */ public void openDriver(SurfaceHolder holder) throws IOException { if (camera == null) { camera = Camera.open(); @@ -119,6 +138,9 @@ final class CameraManager { } } + /** + * Closes the camera driver if still in use. + */ public void closeDriver() { if (camera != null) { camera.release(); @@ -126,6 +148,9 @@ final class CameraManager { } } + /** + * Asks the camera hardware to begin drawing preview frames to the screen. + */ public void startPreview() { if (camera != null && !previewing) { camera.startPreview(); @@ -133,6 +158,9 @@ final class CameraManager { } } + /** + * Tells the camera to stop drawing preview frames. + */ public void stopPreview() { if (camera != null && previewing) { camera.setPreviewCallback(null); @@ -159,6 +187,12 @@ final class CameraManager { } } + /** + * Asks the camera hardware to perform an autofocus. + * + * @param handler The Handler to notify when the autofocus completes. + * @param message The message to deliver. + */ public void requestAutoFocus(Handler handler, int message) { if (camera != null && previewing) { autoFocusHandler = handler; @@ -243,9 +277,10 @@ final class CameraManager { } /** - * Sets the camera up to take preview images which are used for both preview and decoding. We're - * counting on the default YUV420 semi-planar data. If that changes in the future, we'll need to - * specify it explicitly with setPreviewFormat(). + * Sets the camera up to take preview images which are used for both preview and decoding. + * We detect the preview format here so that buildLuminanceSource() can build an appropriate + * LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest, + * and the planar Y can be used for barcode scanning without a copy in some cases. */ private void setCameraParameters() { Camera.Parameters parameters = camera.getParameters(); diff --git a/android/src/com/google/zxing/client/android/InterleavedYUV422LuminanceSource.java b/android/src/com/google/zxing/client/android/InterleavedYUV422LuminanceSource.java index 16c74952..d4341522 100644 --- a/android/src/com/google/zxing/client/android/InterleavedYUV422LuminanceSource.java +++ b/android/src/com/google/zxing/client/android/InterleavedYUV422LuminanceSource.java @@ -131,6 +131,7 @@ public final class InterleavedYUV422LuminanceSource extends BaseLuminanceSource return bitmap; } + // Not currently needed. @Override public Bitmap renderFullColorBitmap(boolean halfSize) { return null;