public final class CameraManager extends Object
| 构造器和说明 |
|---|
CameraManager(android.content.Context context) |
| 限定符和类型 | 方法和说明 |
|---|---|
PlanarYUVLuminanceSource |
buildLuminanceSource(byte[] data,
int width,
int height)
A factory method to build the appropriate LuminanceSource object based on
the format of the preview buffers, as described by Camera.Parameters.
|
void |
closeDriver()
Closes the camera driver if still in use.
|
android.graphics.Rect |
getFramingRect()
Calculates the framing rect which the UI should draw to show the user
where to place the barcode.
|
android.graphics.Rect |
getFramingRectInPreview()
Like
getFramingRect() but coordinates are in terms of the preview
frame, not UI / screen. |
boolean |
isOpen() |
void |
openDriver(android.view.SurfaceHolder holder)
Opens the camera driver and initializes the hardware parameters.
|
void |
requestPreviewFrame(android.os.Handler handler,
int message)
A single preview frame will be returned to the handler supplied.
|
void |
setCameraZoom(int scale) |
void |
setManualFramingRect(int width,
int height)
Allows third party apps to specify the scanning rectangle dimensions,
rather than determine them automatically based on screen resolution.
|
void |
setTorch(boolean newSetting)
Convenience method for
com.sitech.oncon.barcode.core.CaptureActivity |
void |
startPreview()
Asks the camera hardware to begin drawing preview frames to the screen.
|
void |
stopPreview()
Tells the camera to stop drawing preview frames.
|
void |
zoomIn()
焦点放大
|
void |
zoomOut()
焦点放小
|
public static int width
public static int height
public static int scanframe
public void openDriver(android.view.SurfaceHolder holder)
throws IOException
holder - The surface object which the camera will draw preview frames into.IOException - Indicates the camera driver failed to open.public boolean isOpen()
public void closeDriver()
public void startPreview()
public void stopPreview()
public void setTorch(boolean newSetting)
com.sitech.oncon.barcode.core.CaptureActivitypublic void requestPreviewFrame(android.os.Handler handler,
int message)
handler - The handler to send the message to.message - The what field of the message to be sent.public android.graphics.Rect getFramingRect()
public android.graphics.Rect getFramingRectInPreview()
getFramingRect() but coordinates are in terms of the preview
frame, not UI / screen.public void setManualFramingRect(int width,
int height)
width - The width in pixels to scan.height - The height in pixels to scan.public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,
int width,
int height)
data - A preview frame.width - The width of the image.height - The height of the image.public void zoomOut()
public void zoomIn()
public void setCameraZoom(int scale)