java.lang.Object | |
↳ | android.hardware.Camera.Parameters |
Handles the parameters for pictures created by a Camera service.
To make camera parameters take effect, applications have to call Camera.setParameters. For example, after setWhiteBalance is called, white balance is not changed until Camera.setParameters() is called.
Different devices may have different camera capabilities, such as picture size or flash modes. The application should query the camera capabilities before setting parameters. For example, the application should call getSupportedColorEffects before calling setEffect. If the camera does not support color effects, getSupportedColorEffects will return null.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a single string with all the parameters set in
this Parameters object.
| |||||||||||
Returns the value of a String parameter.
| |||||||||||
Gets the current antibanding setting.
| |||||||||||
Gets the current color effect setting.
| |||||||||||
Gets the current exposure compensation index.
| |||||||||||
Gets the exposure compensation step.
| |||||||||||
Gets the current flash mode setting.
| |||||||||||
Gets the focal length (in millimeter) of the camera.
| |||||||||||
Gets the current focus mode setting.
| |||||||||||
Gets the horizontal angle of view in degrees.
| |||||||||||
Returns the value of an integer parameter.
| |||||||||||
Returns the quality setting for the JPEG picture.
| |||||||||||
Returns the quality setting for the EXIF thumbnail in Jpeg picture.
| |||||||||||
Returns the dimensions for EXIF thumbnail in Jpeg picture.
| |||||||||||
Gets the maximum exposure compensation index.
| |||||||||||
Gets the maximum zoom value allowed for snapshot.
| |||||||||||
Gets the minimum exposure compensation index.
| |||||||||||
Returns the image format for pictures.
| |||||||||||
Returns the dimension setting for pictures.
| |||||||||||
Returns the image format for preview frames got from
Camera.PreviewCallback . | |||||||||||
Returns the setting for the rate at which preview frames are
received.
| |||||||||||
Returns the dimensions setting for preview pictures.
| |||||||||||
Gets the current scene mode setting.
| |||||||||||
Gets the supported antibanding values.
| |||||||||||
Gets the supported color effects.
| |||||||||||
Gets the supported flash modes.
| |||||||||||
Gets the supported focus modes.
| |||||||||||
Gets the supported jpeg thumbnail sizes.
| |||||||||||
Gets the supported picture formats.
| |||||||||||
Gets the supported picture sizes.
| |||||||||||
Gets the supported preview formats.
| |||||||||||
Gets the supported preview frame rates.
| |||||||||||
Gets the supported preview sizes.
| |||||||||||
Gets the supported scene modes.
| |||||||||||
Gets the supported white balance.
| |||||||||||
Gets the vertical angle of view in degrees.
| |||||||||||
Gets the current white balance setting.
| |||||||||||
Gets current zoom value.
| |||||||||||
Gets the zoom ratios of all zoom values.
| |||||||||||
Returns true if smooth zoom is supported.
| |||||||||||
Returns true if zoom is supported.
| |||||||||||
Removes GPS latitude, longitude, altitude, and timestamp from the
parameters.
| |||||||||||
Sets an integer parameter.
| |||||||||||
Sets a String parameter.
| |||||||||||
Sets the antibanding.
| |||||||||||
Sets the current color effect setting.
| |||||||||||
Sets the exposure compensation index.
| |||||||||||
Sets the flash mode.
| |||||||||||
Sets the focus mode.
| |||||||||||
Sets GPS altitude.
| |||||||||||
Sets GPS latitude coordinate.
| |||||||||||
Sets GPS longitude coordinate.
| |||||||||||
Sets GPS processing method.
| |||||||||||
Sets GPS timestamp.
| |||||||||||
Sets Jpeg quality of captured picture.
| |||||||||||
Sets the quality of the EXIF thumbnail in Jpeg picture.
| |||||||||||
Sets the dimensions for EXIF thumbnail in Jpeg picture.
| |||||||||||
Sets the image format for pictures.
| |||||||||||
Sets the dimensions for pictures.
| |||||||||||
Sets the image format for preview pictures.
| |||||||||||
Sets the rate at which preview frames are received.
| |||||||||||
Sets the dimensions for preview pictures.
| |||||||||||
Sets the orientation of the device in degrees.
| |||||||||||
Sets the scene mode.
| |||||||||||
Sets the white balance.
| |||||||||||
Sets current zoom value.
| |||||||||||
Takes a flattened string of parameters and adds each one to
this Parameters object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Flash will be fired automatically when required. The flash may be fired during preview, auto-focus, or snapshot depending on the driver.
Flash will not be fired.
Flash will always be fired during snapshot. The flash may also be fired during preview or auto-focus depending on the driver.
Flash will be fired in red-eye reduction mode.
Constant emission of light during preview, auto-focus and snapshot. This can also be used for video recording.
Auto-focus mode.
Extended depth of field (EDOF). Focusing is done digitally and
continuously. Applications should not call autoFocus(AutoFocusCallback)
in this mode.
Focus is fixed. The camera is always in this mode if the focus is not
adjustable. If the camera has auto-focus, this mode can fix the
focus, which is usually at hyperfocal distance. Applications should
not call autoFocus(AutoFocusCallback)
in this mode.
Focus is set at infinity. Applications should not call
autoFocus(AutoFocusCallback)
in this mode.
Applications are looking for a barcode. Camera driver will be optimized for barcode reading.
Creates a single string with all the parameters set in this Parameters object.
The unflatten(String)
method does the reverse.
Returns the value of a String parameter.
key | the key name for the parameter |
---|
Gets the current antibanding setting.
Gets the current color effect setting.
Gets the current exposure compensation index.
getMinExposureCompensation()
to getMaxExposureCompensation()
. 0 means exposure is not
adjusted.
Gets the exposure compensation step.
Gets the current flash mode setting.
Gets the focal length (in millimeter) of the camera.
Gets the current focus mode setting.
FOCUS_MODE_FIXED
. If
the focus mode is not FOCUS_MODE_FIXED or FOCUS_MODE_INFINITY
, applications should call autoFocus(AutoFocusCallback)
to start the focus.Gets the horizontal angle of view in degrees.
Returns the value of an integer parameter.
key | the key name for the parameter |
---|
Returns the quality setting for the JPEG picture.
Returns the quality setting for the EXIF thumbnail in Jpeg picture.
Returns the dimensions for EXIF thumbnail in Jpeg picture.
Gets the maximum exposure compensation index.
getMinExposureCompensation()
return 0,
exposure compensation is not supported.
Gets the maximum zoom value allowed for snapshot. This is the maximum
value that applications can set to setZoom(int)
.
Applications should call isZoomSupported()
before using this
method. This value may change in different preview size. Applications
should call this again after setting preview size.
Gets the minimum exposure compensation index.
getMaxExposureCompensation()
return 0,
exposure compensation is not supported.
Returns the dimension setting for pictures.
Returns the image format for preview frames got from
Camera.PreviewCallback
.
Returns the setting for the rate at which preview frames are received. This is the target frame rate. The actual frame rate depends on the driver.
Returns the dimensions setting for preview pictures.
Gets the current scene mode setting.
Gets the supported antibanding values.
Gets the supported color effects.
Gets the supported flash modes.
Gets the supported focus modes.
Gets the supported jpeg thumbnail sizes.
Gets the supported picture formats.
Gets the supported picture sizes.
Gets the supported preview formats.
Gets the supported preview frame rates.
Gets the supported preview sizes.
Gets the supported scene modes.
Gets the supported white balance.
Gets the vertical angle of view in degrees.
Gets the current white balance setting.
Gets current zoom value. This also works when smooth zoom is in
progress. Applications should check isZoomSupported()
before
using this method.
getMaxZoom()
. 0 means the camera is not zoomed.
Gets the zoom ratios of all zoom values. Applications should check
isZoomSupported()
before using this method.
getMaxZoom()
+ 1. The list is sorted from small to large. The
first element is always 100. The last element is the zoom
ratio of the maximum zoom value.
Returns true if smooth zoom is supported. Applications should call this before using other smooth zoom methods.
Returns true if zoom is supported. Applications should call this before using other zoom methods.
Removes GPS latitude, longitude, altitude, and timestamp from the parameters.
Sets an integer parameter.
key | the key name for the parameter |
---|---|
value | the int value of the parameter |
Sets a String parameter.
key | the key name for the parameter |
---|---|
value | the String value of the parameter |
Sets the exposure compensation index.
value | exposure compensation index. The valid value range is
from getMinExposureCompensation() (inclusive) to getMaxExposureCompensation() (inclusive). 0 means exposure is
not adjusted. Application should call
getMinExposureCompensation and getMaxExposureCompensation to
know if exposure compensation is supported.
|
---|
Sets GPS altitude. This will be stored in JPEG EXIF header.
altitude | GPS altitude in meters. |
---|
Sets GPS latitude coordinate. This will be stored in JPEG EXIF header.
latitude | GPS latitude coordinate. |
---|
Sets GPS longitude coordinate. This will be stored in JPEG EXIF header.
longitude | GPS longitude coordinate. |
---|
Sets GPS processing method. It will store up to 32 characters in JPEG EXIF header.
processing_method | The processing method to get this location. |
---|
Sets GPS timestamp. This will be stored in JPEG EXIF header.
timestamp | GPS timestamp (UTC in seconds since January 1, 1970). |
---|
Sets Jpeg quality of captured picture.
quality | the JPEG quality of captured picture. The range is 1 to 100, with 100 being the best. |
---|
Sets the quality of the EXIF thumbnail in Jpeg picture.
quality | the JPEG quality of the EXIF thumbnail. The range is 1 to 100, with 100 being the best. |
---|
Sets the dimensions for EXIF thumbnail in Jpeg picture. If applications set both width and height to 0, EXIF will not contain thumbnail.
width | the width of the thumbnail, in pixels |
---|---|
height | the height of the thumbnail, in pixels |
Sets the image format for pictures.
pixel_format | the desired picture format (ImageFormat.NV21, ImageFormat.RGB_565, or ImageFormat.JPEG) |
---|
Sets the dimensions for pictures.
width | the width for pictures, in pixels |
---|---|
height | the height for pictures, in pixels |
Sets the image format for preview pictures.
If this is never called, the default format will be
NV21
, which
uses the NV21 encoding format.
pixel_format | the desired preview picture format, defined
by one of the ImageFormat constants.
(E.g., ImageFormat.NV21 (default),
ImageFormat.RGB_565, or
ImageFormat.JPEG) |
---|
Sets the rate at which preview frames are received. This is the target frame rate. The actual frame rate depends on the driver.
fps | the frame rate (frames per second) |
---|
Sets the dimensions for preview pictures.
width | the width of the pictures, in pixels |
---|---|
height | the height of the pictures, in pixels |
Sets the orientation of the device in degrees. For example, suppose
the natural position of the device is landscape. If the user takes a
picture in landscape mode in 2048x1536 resolution, the rotation
should be set to 0. If the user rotates the phone 90 degrees
clockwise, the rotation should be set to 90. Applications can use
OrientationEventListener
to set this parameter.
The camera driver may set orientation in the EXIF header without
rotating the picture. Or the driver may rotate the picture and
the EXIF thumbnail. If the Jpeg picture is rotated, the orientation
in the EXIF header will be missing or 1 (row #0 is top and column #0
is left side).
rotation | The orientation of the device in degrees. Rotation can only be 0, 90, 180 or 270. |
---|
IllegalArgumentException | if rotation value is invalid. |
---|
Sets the scene mode. Changing scene mode may override other parameters (such as flash mode, focus mode, white balance). For example, suppose originally flash mode is on and supported flash modes are on/off. In night scene mode, both flash mode and supported flash mode may be changed to off. After setting scene mode, applications should call getParameters to know if some parameters are changed.
value | scene mode. |
---|
Sets current zoom value. If the camera is zoomed (value > 0), the
actual picture size may be smaller than picture size setting.
Applications can check the actual picture size after picture is
returned from Camera.PictureCallback
. The preview size remains the
same in zoom. Applications should check isZoomSupported()
before using this method.
value | zoom value. The valid range is 0 to getMaxZoom() .
|
---|
Takes a flattened string of parameters and adds each one to this Parameters object.
The flatten()
method does the reverse.
flattened | a String of parameters (key-value paired) that are semi-colon delimited |
---|