public static interface FrameConfig.Builder
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
FrameConfig.Builder |
addSurface(Surface surface) |
Adds a surface as frame capture output.
|
FrameConfig |
build() |
Creates a
FrameConfig object. |
<T> T |
get(ParameterKey.Key<T> key) |
Gets the parameter value of the current frame capture configuration.
|
int |
getAeMode() |
Gets the automatic exposure (AE) mode configured for the current frame capture.
|
Rect |
getAeRect() |
Gets the AE area configured for the current frame capture.
|
int |
getAeTrigger() |
Gets the AE trigger type configured for the current frame capture.
|
int |
getAfMode() |
Gets the autofocus (AF) mode configured for the current frame capture.
|
Rect |
getAfRect() |
Gets the AF area configured for the current frame capture.
|
int |
getAfTrigger() |
Gets the AF trigger type configured for the current frame capture.
|
int |
getAwbMode() |
Gets the auto white balance (AWB) mode set for the current frame capture.
|
Surface |
getCoordinateSurface() |
Obtains the surface on which the central coordinate system is based.
|
int |
getFaceDetectionType() |
Gets the face detection type configured for the current frame capture.
|
int |
getFlashMode() |
Gets the flash mode configured for the current frame capture.
|
int |
getFrameConfigType() |
Gets the template type for frame capture configuration.
|
int |
getImageRotation() |
Gets the image rotation angle configured for the current frame capture.
|
List<ParameterKey.Key<?>> |
getKeys() |
Gets all parameters for the current frame capture configuration.
|
Location |
getLocation() |
Gets the geolocation configured for the current frame capture.
|
List<Surface> |
getSurfaces() |
Gets all surfaces configured for the current frame capture.
|
float |
getZoomValue() |
Gets the zoom value configured for the current frame capture.
|
FrameConfig.Builder |
removeSurface(Surface surface) |
Removes an output surface.
|
FrameConfig.Builder |
setAeMode(int aeMode,
Rect rect) |
Sets the AE mode.
|
FrameConfig.Builder |
setAeTrigger(int aeTrigger) |
Triggers an AE.
|
FrameConfig.Builder |
setAfMode(int afMode,
Rect rect) |
Sets the AF mode.
|
FrameConfig.Builder |
setAfTrigger(int afTrigger) |
Triggers an AF.
|
FrameConfig.Builder |
setAwbMode(int awbMode,
Rect rect) |
Sets the auto white balance (AWB) mode.
|
FrameConfig.Builder |
setCoordinateSurface(Surface surface) |
Sets the surface holding the central coordinate system.
|
FrameConfig.Builder |
setFaceDetection(int type,
boolean isEnable) |
Sets face detection and returns the result through a callback.
|
FrameConfig.Builder |
setFlashMode(int flashMode) |
Sets the flash mode.
|
FrameConfig.Builder |
setImageRotation(int degrees) |
Sets an image rotation angle to correct the image rotation information at the HAL layer.
|
FrameConfig.Builder |
setLocation(Location location) |
Sets geolocation information.
|
FrameConfig.Builder |
setMark(Object mark) |
Sets the unique mark on a
FrameConfig instance. |
<T> FrameConfig.Builder |
setParameter(ParameterKey.Key<T> key,
T value) |
Sets a camera parameter.
|
FrameConfig.Builder |
setZoom(float value) |
Sets a zoom value.
|
FrameConfig.Builder addSurface(Surface surface)
The output surface to be added must have been added by calling
CameraConfig.Builder#addSurface(Surface), and the camera have been successfully configured with
CameraConfig. Otherwise, frame capture methods defined in Camera may throw parameter
exceptions.
surface - Indicates an output surface to be added.Builder object.FrameConfig.Builder removeSurface(Surface surface)
surface - Indicates a surface added as frame capture output.Builder object.FrameConfig.Builder setFaceDetection(int type, boolean isEnable)
Only a supported type of face detection can be set using this method. The supported face detection types
can be obtained by calling CameraAbility#getSupportedFaceDetection().
The face detection result can be obtained by FrameResult#getFaceDetectionResult().
type - Indicates the face detection type.
The face detection type to set must be one or more supported types.
Both Metadata.FaceDetectionType.FACE_DETECTION and
Metadata.FaceDetectionType.FACE_SMILE_DETECTION can be enabled simultaneously by calling
setFaceDetection(FaceDetectionType.FACE_DETECTION | FaceDetectionType.FACE_SMILE_DETECTION, true).
An invalid detection type will be ignored.
isEnable - Indicates whether face detection is enabled. true means detection is enabled, while
false means it is disabled.Builder object.Metadata.FaceDetectionTypeFrameConfig.Builder setAfMode(int afMode, Rect rect)
Only a supported AF mode can be set using this method. The supported AF modes can be obtained by
CameraAbility#getSupportedAfMode().
The AF result can be obtained by FrameResult#getAfResult().
afMode - Indicates the AF mode to set. An invalid AF mode will be ignored.rect - Indicates a rectangular area for AF.
If the input value is null, the area is the same as the preview area.
The central coordinate system is adopted, which ranges from (-1000, -1000) to (1000, 1000), to describe the
AF area. The value range and direction are consistent with those of the preview area, regardless of zooming,
rotation direction, and other factors alike.
If the rectangle AF area exceeds the valid range, the AF mode will not take effect.
Builder object.Metadata.AfModeFrameConfig.Builder setAfTrigger(int afTrigger)
Only supported types of AF triggers can be set using this method.
The AF result can be obtained by FrameResult#getAfResult().
afTrigger - Indicates the AF trigger type to set. An invalid trigger type will be ignored.Builder object.Metadata.AfTriggerFrameConfig.Builder setAeMode(int aeMode, Rect rect)
Only a supported AE mode can be set using this method. The supported AE modes can be obtained by
CameraAbility#getSupportedAeMode().
The AE result can be obtained by FrameResult#getAeResult().
aeMode - Indicates the AE mode to set. An invalid AE mode will be ignored.rect - Indicates the rectangle area for AE.
If the input value is null, the area is the same as the preview area.
The central coordinate system is adopted, which ranges from (-1000, -1000) to (1000, 1000), to describe the
AE area. The value range and direction are consistent with those of the preview area, regardless of zooming,
rotation direction, and other factors alike.
If the rectangle AE area exceeds the valid range, the AE mode will not take effect.
Builder object.Metadata.AeModeFrameConfig.Builder setAeTrigger(int aeTrigger)
Only supported types of AE triggers can be set using this method.
The AE result can be obtained by calling FrameResult#getAeResult().
aeTrigger - Indicates the AE trigger type. An invalid trigger type will be ignored.Builder object.Metadata.AeTriggerFrameConfig.Builder setAwbMode(int awbMode, Rect rect)
You can call this method to set only the supported AWB modes
got via CameraAbility#getSupportedAwbMode().
awbMode - Indicates the AWB mode to set. An invalid AWB mode will be ignored.rect - Indicates the rectangle area for AWB.
If the input value is null, the area is the same as the preview area. The central coordinate
system is adopted, which ranges from (-1000, -1000) to (1000, 1000), to describe the AWB area.
The value range and direction are consistent with those of the preview area, regardless of zooming,
rotation direction, and other factors alike.
If the AWB area exceeds the valid range, the AWB mode will not take effect.
Builder object.Metadata.AwbModeFrameConfig.Builder setZoom(float value)
Only a zoom value within the supported range can be set using this method. The supported zoom value range
can be obtained by calling CameraAbility#getSupportedZoom().
value - Indicates the zoom value to set.
The value must be within the supported range. An invalid zoom value will be ignored.
Builder object.FrameConfig.Builder setFlashMode(int flashMode)
Only supported flash mode can be set using this method. The supported flash modes can be obtained by
calling CameraAbility#getSupportedFlashMode().
flashMode - Indicates the flash mode to set. An invalid flash mode will be ignored.Builder object.Metadata.FlashModeFrameConfig.Builder setMark(Object mark)
FrameConfig instance.
The mark is used to identify a FrameConfig instance during frame processing by the camera.
mark - Indicates the unique FrameConfig mark.Builder object.FrameStateCallback.onFrameStarted(Camera, FrameConfig, long, long),
FrameStateCallback.onFrameProgressed(Camera, FrameConfig, FrameResult),
FrameStateCallback.onFrameFinished(Camera, FrameConfig, FrameResult),
FrameStateCallback.onFrameError(Camera, FrameConfig, int, FrameResult),
FrameConfig.getMark()FrameConfig.Builder setLocation(Location location)
location - Indicates the geolocation information to set. The value can be null, which means that
a saved image does not have geolocation information.Builder object.FrameConfig.Builder setImageRotation(int degrees)
This method is used to update the rotation angle of an image (or a frame in JPEG format) whenever it is captured.
degrees - Indicates degrees of the rotation angle.
The value should be a multiple of 90, such as 0, 90, 180, and 270. Other integers will be rounded to multiples of 90.
Builder object.<T> FrameConfig.Builder setParameter(ParameterKey.Key<T> key, T value)
Only a supported parameter can be set using this method. Supported camera parameters can be obtained by
calling CameraAbility#getSupportedParameters(). The parameter value range can be obtained by CameraAbility#getParameterRange(ParameterKey.Key).
The results related to the parameter settings can be obtained by FrameResult#getParametersResult().
T - Indicates the data type of a camera parameter.key - Indicates a camera parameter to set.value - Indicates a parameter value.
The value must be within the value range. An invalid value is ignored.
Builder object.CameraAbility.getSupportedParameters(),
CameraAbility.getParameterRange(ParameterKey.Key)Surface getCoordinateSurface()
setCoordinateSurface(Surface)int getFrameConfigType()
Camera.FrameConfigType,
Camera.getFrameConfigBuilder(int)List<Surface> getSurfaces()
addSurface(Surface)FrameConfig.Builder setCoordinateSurface(Surface surface)
Origin coordinates of the central camera coordinate system are calculated based on the surface. The
surface must have been added to the FrameConfig instance by the addSurface(ohos.agp.graphics.Surface)
method. If no surface has been set by setCoordinateSurface(Surface), the first surface added by the
addSurface(ohos.agp.graphics.Surface) method is used as the basis of the central coordinate system.
surface - Indicates the surface to be used as the basis of the central coordinate system.Builder object.NullPointerException - Throws this exception if surface is null.IllegalStateException - Throws this exception if surface does not exist in the
FrameConfig instance.int getAfMode()
Metadata.AfMode,
setAfMode(int, Rect)Rect getAfRect()
setAfMode(int, Rect)int getAfTrigger()
Metadata.AfTrigger,
setAfTrigger(int)int getAeMode()
Metadata.AeMode,
setAeMode(int, Rect)Rect getAeRect()
setAeMode(int, Rect)int getAeTrigger()
Metadata.AeTrigger,
setAeTrigger(int)int getAwbMode()
Metadata.AwbMode#AWB_AUTOMATIC if the AWB mode is not set.Metadata.AwbMode,
setAwbMode(int, Rect)float getZoomValue()
setZoom(float)int getFlashMode()
Metadata.FlashMode,
setFlashMode(int)int getFaceDetectionType()
Metadata.FaceDetectionType,
setFaceDetection(int, boolean)Location getLocation()
null if there is no configuration.setLocation(Location)int getImageRotation()
setImageRotation(int)<T> T get(ParameterKey.Key<T> key)
T - Indicates the type of the parameter value.key - Indicates the parameter.setParameter(ParameterKey.Key, Object)List<ParameterKey.Key<?>> getKeys()
setParameter(ParameterKey.Key, Object)FrameConfig build()
FrameConfig object.FrameConfig object, which is used by Camera for the frame capture.