CanvasBufferedRenderer.Builder
public final class CanvasBufferedRenderer.Builder
Builder used to construct a CanvasBufferedRenderer instance.
Summary
Public constructors |
|---|
Builder(int width, int height) |
Public methods |
|
|---|---|
final @NonNull CanvasBufferedRenderer |
build()Create the |
final @NonNull CanvasBufferedRenderer.Builder |
setBufferFormat(int format)Specify the buffer format of the underlying buffers being rendered into by the created |
final @NonNull CanvasBufferedRenderer.Builder |
setMaxBuffers(@IntRange(from = 1, to = 64) int numBuffers)Specify the maximum number of buffers used within the swap chain of the |
final @NonNull CanvasBufferedRenderer.Builder |
setUsageFlags(long usageFlags)Specify the usage flags to be configured on the underlying |
Public constructors
Builder
public Builder(int width, int height)
| Parameters | |
|---|---|
int width |
Width of the buffers created by the |
int height |
Height of the buffers created by the |
Public methods
build
public final @NonNull CanvasBufferedRenderer build()
Create the CanvasBufferedRenderer with the specified parameters on this Builder instance.
| Returns | |
|---|---|
@NonNull CanvasBufferedRenderer |
The newly created |
setBufferFormat
public final @NonNull CanvasBufferedRenderer.Builder setBufferFormat(int format)
Specify the buffer format of the underlying buffers being rendered into by the created CanvasBufferedRenderer. The set of valid formats is implementation-specific. The particular valid combinations for a given Android version and implementation should be documented by that version.
HardwareBuffer.RGBA_8888 and HardwareBuffer.RGBX_8888 are guaranteed to be supported. However, consumers are recommended to query the desired HardwareBuffer configuration using HardwareBuffer.isSupported.
| Parameters | |
|---|---|
int format |
Pixel format of the buffers to be rendered into. The default is RGBA_8888. |
| Returns | |
|---|---|
@NonNull CanvasBufferedRenderer.Builder |
The builder instance |
setMaxBuffers
public final @NonNull CanvasBufferedRenderer.Builder setMaxBuffers(@IntRange(from = 1, to = 64) int numBuffers)
Specify the maximum number of buffers used within the swap chain of the CanvasBufferedRenderer. If 1 is specified, then the created CanvasBufferedRenderer is running in "single buffer mode". In this case consumption of the buffer content would need to be coordinated with the SyncFenceCompat returned by the callback of RenderRequest.drawAsync.
| Parameters | |
|---|---|
@IntRange(from = 1, to = 64) int numBuffers |
The number of buffers within the swap chain to be consumed by the created |
| Returns | |
|---|---|
@NonNull CanvasBufferedRenderer.Builder |
The builder instance |
| See also | |
|---|---|
drawAsync |
setUsageFlags
public final @NonNull CanvasBufferedRenderer.Builder setUsageFlags(long usageFlags)
Specify the usage flags to be configured on the underlying HardwareBuffer instances created by the CanvasBufferedRenderer.
| Parameters | |
|---|---|
long usageFlags |
Usage flags to be configured on the created |
| Returns | |
|---|---|
@NonNull CanvasBufferedRenderer.Builder |
The builder instance |