public final class CameraManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static android.hardware.Camera.AutoFocusCallback |
afCallback |
android.hardware.Camera |
camera |
com.manateeworks.CameraConfigurationManager |
configManager |
static float |
currentFPS |
static boolean |
DEBUG |
java.util.Timer |
focusTimer |
android.view.SurfaceHolder |
lastHolder |
static int |
mDesiredHeight |
static int |
mDesiredWidth |
com.manateeworks.PreviewCallback |
previewCallback |
boolean |
previewing |
static int |
REFOCUSING_DELAY |
static boolean |
refocusingActive |
static java.lang.String |
TAG |
static boolean |
USE_FRONT_CAMERA |
static boolean |
USE_SAMSUNG_FOCUS_ZOOM_PATCH |
static boolean |
useBufferedCallback |
| Modifier and Type | Method and Description |
|---|---|
void |
closeDriver()
Closes the Camera object and releases resources.
|
static CameraManager |
get()
Returns the CameraManager object.
|
android.graphics.Point |
getCurrentResolution() |
int |
getDeviceDefaultOrientation() |
float[] |
getExposureCompensationRange() |
android.graphics.Point |
getMaxResolution() |
int |
getMaxZoom()
Gets the maximum zoom level the Camera supports.
|
android.graphics.Point |
getNormalResolution(android.graphics.Point normalRes) |
static void |
init(android.content.Context context)
Initializes a new CameraManager object with the provided Context.
|
boolean |
isTorchAvailable()
Checks torch availability.
|
void |
openDriver(android.view.SurfaceHolder holder,
boolean isPortrait)
Invokes Camera.open and configures the Camera.
|
android.graphics.Bitmap |
renderCroppedGreyscaleBitmap(byte[] data,
int width,
int height)
Converts a YUV format frame to Bitmap grayscale frame.
|
void |
requestAutoFocus(android.os.Handler handler,
int message) |
void |
requestPreviewFrame(android.os.Handler handler,
int message)
Requests a preview frame.
|
void |
setCameraDisplayOrientation(int cameraId,
android.hardware.Camera camera,
boolean isPortrait)
Sets the camera display orientation.
|
static void |
setDesiredPreviewSize(int width,
int height)
Select desired camera resolution.
|
void |
setExposureCompensation(float value) |
void |
setTorch(boolean enabled)
Turns the torch on or off.
|
void |
setZoom(int zoom)
Sets the Camera zoom level.
|
void |
startFocusing() |
void |
startPreview()
Starts the Camera Preview and starts focusing.
|
void |
stopFocusing() |
void |
stopPreview()
Stops the Camera Preview and stops focusing.
|
void |
updateCameraOrientation(int rotation) |
public static float currentFPS
public static int REFOCUSING_DELAY
public static boolean USE_SAMSUNG_FOCUS_ZOOM_PATCH
public static boolean USE_FRONT_CAMERA
public final com.manateeworks.CameraConfigurationManager configManager
public android.hardware.Camera camera
public boolean previewing
public static boolean useBufferedCallback
public static int mDesiredWidth
public static int mDesiredHeight
public android.view.SurfaceHolder lastHolder
public java.util.Timer focusTimer
public static android.hardware.Camera.AutoFocusCallback afCallback
public static boolean refocusingActive
public static boolean DEBUG
public static java.lang.String TAG
public final com.manateeworks.PreviewCallback previewCallback
public static void setDesiredPreviewSize(int width,
int height)
width - desired preview widthheight - desired preview heightpublic android.graphics.Point getMaxResolution()
public android.graphics.Point getCurrentResolution()
public android.graphics.Point getNormalResolution(android.graphics.Point normalRes)
public static void init(android.content.Context context)
context - Activity contextpublic static CameraManager get()
public void openDriver(android.view.SurfaceHolder holder,
boolean isPortrait)
throws java.io.IOException
holder - surface holderisPortrait - true if portraitjava.io.IOException - error when camera open fails after multiple triespublic int getMaxZoom()
public void setZoom(int zoom)
zoom - zoom levelpublic boolean isTorchAvailable()
public void setTorch(boolean enabled)
enabled - set to true to turn torch onpublic float[] getExposureCompensationRange()
public void setExposureCompensation(float value)
public void closeDriver()
public void startFocusing()
public void stopFocusing()
public void startPreview()
public void stopPreview()
public void requestPreviewFrame(android.os.Handler handler,
int message)
handler - handler to send the frame tomessage - message to pass the handlerpublic void requestAutoFocus(android.os.Handler handler,
int message)
public int getDeviceDefaultOrientation()
public void updateCameraOrientation(int rotation)
public void setCameraDisplayOrientation(int cameraId,
android.hardware.Camera camera,
boolean isPortrait)
cameraId - The ID of the chosen camera.camera - The Camera object.isPortrait - true if portraitpublic android.graphics.Bitmap renderCroppedGreyscaleBitmap(byte[] data,
int width,
int height)
data - YUV frame from camerawidth - frame widthheight - frame height