Builder
class Builder
kotlin.Any | |
↳ | android.view.SurfaceControl.Builder |
Builder class for SurfaceControl
objects. By default the surface will be hidden, and have "unset" bounds, meaning it can be as large as the bounds of its parent if a buffer or child so requires. It is necessary to set at least a name via Builder.setName
Summary
Public constructors | |
---|---|
Builder() Begin building a SurfaceControl. |
Public methods | |
---|---|
open SurfaceControl |
build() Construct a new |
open SurfaceControl.Builder |
setBufferSize(width: Int, height: Int) Set the initial size of the controlled surface's buffers in pixels. |
open SurfaceControl.Builder |
Set the pixel format of the controlled surface's buffers, using constants from |
open SurfaceControl.Builder |
Set the initial visibility for the SurfaceControl. |
open SurfaceControl.Builder |
Set a debugging-name for the SurfaceControl. |
open SurfaceControl.Builder |
Indicates whether the surface must be considered opaque, even if its pixel format is set to translucent. |
open SurfaceControl.Builder |
setParent(parent: SurfaceControl?) Set a parent surface for our new SurfaceControl. |
Public constructors
Public methods
build
open fun build(): SurfaceControl
Construct a new SurfaceControl
with the set parameters. The builder remains valid.
Return | |
---|---|
SurfaceControl |
This value cannot be null . |
setBufferSize
open fun setBufferSize(
width: Int,
height: Int
): SurfaceControl.Builder
Set the initial size of the controlled surface's buffers in pixels.
Parameters | |
---|---|
width |
Int: The buffer width in pixels. Value is 0 or greater |
height |
Int: The buffer height in pixels. Value is 0 or greater |
Return | |
---|---|
SurfaceControl.Builder |
This value cannot be null . |
setFormat
open fun setFormat(format: Int): SurfaceControl.Builder
Set the pixel format of the controlled surface's buffers, using constants from android.graphics.PixelFormat
.
Parameters | |
---|---|
format |
Int: Value is android.graphics.PixelFormat#RGBA_8888 , android.graphics.PixelFormat#RGBX_8888 , android.graphics.PixelFormat#RGBA_F16 , android.graphics.PixelFormat#RGBA_1010102 , android.graphics.PixelFormat#RGB_888 , android.graphics.PixelFormat#RGB_565 , or android.graphics.PixelFormat.R_8 |
Return | |
---|---|
SurfaceControl.Builder |
This value cannot be null . |
setHidden
open fun setHidden(: Boolean): SurfaceControl.Builder
Set the initial visibility for the SurfaceControl.
Parameters | |
---|---|
hidden |
Boolean: Whether the Surface is initially HIDDEN. |
Return | |
---|---|
SurfaceControl.Builder |
This value cannot be null . |
setName
open fun setName(name: String): SurfaceControl.Builder
Set a debugging-name for the SurfaceControl.
Parameters | |
---|---|
name |
String: A name to identify the Surface in debugging. This value cannot be null . |
Return | |
---|---|
SurfaceControl.Builder |
This value cannot be null . |
setOpaque
open fun setOpaque(opaque: Boolean): SurfaceControl.Builder
Indicates whether the surface must be considered opaque, even if its pixel format is set to translucent. This can be useful if an application needs full RGBA 8888 support for instance but will still draw every pixel opaque.
This flag only determines whether opacity will be sampled from the alpha channel. Plane-alpha from calls to setAlpha() can still result in blended composition regardless of the opaque setting. Combined effects are (assuming a buffer format with an alpha channel):
- OPAQUE + alpha(1.0) == opaque composition
- OPAQUE + alpha(0.x) == blended composition
- OPAQUE + alpha(0.0) == no composition
- !OPAQUE + alpha(1.0) == blended composition
- !OPAQUE + alpha(0.x) == blended composition
- !OPAQUE + alpha(0.0) == no composition
Parameters | |
---|---|
opaque |
Boolean: Whether the Surface is OPAQUE. |
Return | |
---|---|
SurfaceControl.Builder |
This value cannot be null . |
setParent
open fun setParent(parent: SurfaceControl?): SurfaceControl.Builder
Set a parent surface for our new SurfaceControl. Child surfaces are constrained to the onscreen region of their parent. Furthermore they stack relatively in Z order, and inherit the transformation of the parent.
Parameters | |
---|---|
parent |
SurfaceControl?: The parent control. This value may be null . |
Return | |
---|---|
SurfaceControl.Builder |
This value cannot be null . |