CanvasBufferedRenderer.Builder
class CanvasBufferedRenderer.Builder
Builder used to construct a CanvasBufferedRenderer instance.
Summary
Public functions |
|
|---|---|
CanvasBufferedRenderer |
build()Create the |
CanvasBufferedRenderer.Builder |
setBufferFormat(format: Int)Specify the buffer format of the underlying buffers being rendered into by the created |
CanvasBufferedRenderer.Builder |
setMaxBuffers(numBuffers: @IntRange(from = 1, to = 64) Int)Specify the maximum number of buffers used within the swap chain of the |
CanvasBufferedRenderer.Builder |
setUsageFlags(usageFlags: Long)Specify the usage flags to be configured on the underlying |
Public constructors
Builder
Builder(width: Int, height: Int)
| Parameters | |
|---|---|
width: Int |
Width of the buffers created by the |
height: Int |
Height of the buffers created by the |
Public functions
build
fun build(): CanvasBufferedRenderer
Create the CanvasBufferedRenderer with the specified parameters on this Builder instance.
| Returns | |
|---|---|
CanvasBufferedRenderer |
The newly created |
setBufferFormat
fun setBufferFormat(format: Int): CanvasBufferedRenderer.Builder
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 | |
|---|---|
format: Int |
Pixel format of the buffers to be rendered into. The default is RGBA_8888. |
| Returns | |
|---|---|
CanvasBufferedRenderer.Builder |
The builder instance |
setMaxBuffers
fun setMaxBuffers(numBuffers: @IntRange(from = 1, to = 64) Int): CanvasBufferedRenderer.Builder
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 | |
|---|---|
numBuffers: @IntRange(from = 1, to = 64) Int |
The number of buffers within the swap chain to be consumed by the created |
| Returns | |
|---|---|
CanvasBufferedRenderer.Builder |
The builder instance |
| See also | |
|---|---|
drawAsync |
setUsageFlags
fun setUsageFlags(usageFlags: Long): CanvasBufferedRenderer.Builder
Specify the usage flags to be configured on the underlying HardwareBuffer instances created by the CanvasBufferedRenderer.
| Parameters | |
|---|---|
usageFlags: Long |
Usage flags to be configured on the created |
| Returns | |
|---|---|
CanvasBufferedRenderer.Builder |
The builder instance |