CloseableSurface

An owned Android Surface paired with the Android resource that backs it. Used only to create a RiveSurface with CommandQueue.createRiveSurface, which takes ownership, while also encoding resource cleanup.

Once passed to CommandQueue.createRiveSurface, the caller should not call close directly. Rather, this surface will be wrapped and owned by a RiveSurface that calls close after successful creation, or closed by CommandQueue.createRiveSurface if creation fails.

width and height are creation-time dimensions in physical pixels. They are not live properties of the backing Android resource after CommandQueue.createRiveSurface returns. Mutable surfaces, such as SurfaceTextureSurface, report later size changes through RiveSurface.resize instead of mutating this wrapper.

resizable indicates whether the Android backing resource supports in-place size changes. The created RiveSurface copies this value at construction and uses it to decide whether RiveSurface.resize is valid.

After successful creation, resource cleanup is ordered asynchronously on the command queue so that Android resources are not released until all pending commands that target the surface have completed.

Inheritors

Properties

Link copied to clipboard
abstract val height: Int

Creation-time height in physical pixels.

Link copied to clipboard
abstract val resizable: Boolean

Whether the backing Android resource supports in-place size changes.

Link copied to clipboard
abstract val surface: Surface

Surface used to create the backend render target.

Link copied to clipboard
abstract val width: Int

Creation-time width in physical pixels.

Functions

Link copied to clipboard
abstract override fun close()

Releases the Android resources backing surface.