public class Camera2RequestSettingsSet extends Object
CaptureRequest
.Constructor and Description |
---|
Camera2RequestSettingsSet()
Create a new instance with no settings defined.
|
Camera2RequestSettingsSet(Camera2RequestSettingsSet other)
Perform a deep copy of the defined settings and revision number.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(CaptureRequest.Key<?> key)
Query this instance for whether it prefers a particular choice for the
given request parameter.
|
CaptureRequest |
createRequest(CameraDevice camera,
int template,
Surface... targets)
Create a
CaptureRequest specialized for the specified
CameraDevice and targeting the given Surface s. |
<T> T |
get(CaptureRequest.Key<T> key)
Interrogate the current specialization of a setting.
|
long |
getRevision()
Get this set of settings's revision identifier, which can be compared
against cached past values to determine whether it has been modified.
|
<T> boolean |
matches(CaptureRequest.Key<T> key,
T value)
Check whether the value of the specified setting matches the given one.
|
<T> boolean |
set(CaptureRequest.Key<T> key,
T value)
Specify a setting, potentially overriding the template's default choice.
|
boolean |
union(Camera2RequestSettingsSet moreSettings)
Add all settings choices defined by
moreSettings to this object. |
boolean |
unset(CaptureRequest.Key<?> key)
Unsets a setting, preventing it from being propagated with unions or from
overriding the default when creating a capture request.
|
public Camera2RequestSettingsSet()
Creating a request from this object without first specifying any
properties on it is equivalent to just creating a request directly
from the template of choice. Its revision identifier is initially
0
, and will remain thus until its first modification.
public Camera2RequestSettingsSet(Camera2RequestSettingsSet other)
other
- The reference instance.NullPointerException
- If other
is null
.public <T> boolean set(CaptureRequest.Key<T> key, T value)
Providing a null
value
will indicate a forced use of
the template's selection for that key
; the difference here is
that this information will be propagated with unions as documented in
union(com.android.ex.camera2.utils.Camera2RequestSettingsSet)
. This method increments the revision identifier if the new
choice is different than the existing selection.
key
- Which setting to alter.value
- The new selection for that setting, or null
to force
the use of the template's default selection for this field.value
is different from any already stored.NullPointerException
- If key
is null
.public boolean unset(CaptureRequest.Key<?> key)
This method increments the revision identifier if a selection had previously been made for that parameter.
key
- Which setting to reset.NullPointerException
- If key
is null
.public <T> T get(CaptureRequest.Key<T> key)
key
- Which setting to check.null
if the
setting is unset or forced to the template-defined default.NullPointerException
- If key
is null
.public boolean contains(CaptureRequest.Key<?> key)
This method can be used to detect whether a particular field is forced
to its default value or simply unset. While get(android.hardware.camera2.CaptureRequest.Key<T>)
will return
null
in both these cases, this method will return true
and false
, respectively.
key
- Which setting to look for.NullPointerException
- If key
is null
.public <T> boolean matches(CaptureRequest.Key<T> key, T value)
This method uses the T
type's equals
method, but is
null
-tolerant.
key
- Which of this class's settings to check.value
- Value to test for equality against.public long getRevision()
Distinct revisions across the same object do not necessarily indicate that the object's key/value pairs have changed at all, but the same revision on the same object does imply that they've stayed the same.
public boolean union(Camera2RequestSettingsSet moreSettings)
moreSettings
to this object.
For any settings defined in both, the choice stored in the argument
to this method take precedence. Unset settings are not propagated, but
those forced to default as described in set
are also forced to
default in this
set. Invoking this method increments this
object's revision counter, but leaves the argument's unchanged.
moreSettings
- The source of the additional settings (null
is allowed here).public CaptureRequest createRequest(CameraDevice camera, int template, Surface... targets) throws CameraAccessException
CaptureRequest
specialized for the specified
CameraDevice
and targeting the given Surface
s.camera
- The camera from which to capture.template
- A CaptureRequest
template defined in
CameraDevice
.targets
- The location(s) to draw the resulting image onto.CameraAccessException
- Upon an underlying framework API failure.NullPointerException
- If any argument is null
.