Renderer

abstract class Renderer(var type: RendererType = Rive.defaultRendererType, val trace: Boolean = false) : NativeObject, Choreographer.FrameCallback

Inheritors

Constructors

Link copied to clipboard
constructor(type: RendererType = Rive.defaultRendererType, trace: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Getter/Setter for the underlying C++ pointer value.

Link copied to clipboard
Link copied to clipboard

A lock to synchronize access to the C++ renderer object between the UI thread (which handles lifecycle events like delete()) and the Choreographer thread (which executes doFrame()). This prevents a race condition where the UI thread might nullify the C++ pointer while the worker thread is still using it.

Link copied to clipboard

Whether this objects underlying pointer is still valid.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Optional callback for EGL context-loss lifecycle events (Lost/Recovered).

Link copied to clipboard
open val refCount: Int
Link copied to clipboard
override var refs: AtomicInteger
Link copied to clipboard
Link copied to clipboard
@get:VisibleForTesting(otherwise = 2)
var type: RendererType
Link copied to clipboard

Functions

Link copied to clipboard
open override fun acquire(): Int

Increments the references for this counter. Cannot be used for initialization - use refs.incrementAndGet instead.

Link copied to clipboard
abstract fun advance(elapsed: Float)
Link copied to clipboard
fun align(fit: Fit, alignment: Alignment, targetBounds: RectF, sourceBounds: RectF, scaleFactor: Float = 1.0f)
Link copied to clipboard
open external override fun cppDelete(pointer: Long)
Link copied to clipboard
open fun delete()

Schedules the deletion of the underlying C++ object using a two-phase disposal pattern.

Link copied to clipboard
open override fun doFrame(frameTimeNanos: Long)
Link copied to clipboard
abstract fun draw()
Link copied to clipboard
open fun make()
Link copied to clipboard
open override fun release(): Int

Decrements the reference counter.

Link copied to clipboard
fun restore()
Link copied to clipboard
fun save()
Link copied to clipboard
fun scale(sx: Float, sy: Float)
Link copied to clipboard
open fun scheduleFrame()

Schedule a new frame callback to the Choreographer loop, calling back to doFrame.

Link copied to clipboard
fun setSurface(surface: Surface)

Sets the drawing surface for the renderer.

Link copied to clipboard
fun start()

Starts the renderer and registers for frameCallbacks.

Link copied to clipboard

Calls stopThread and removes any pending FrameCallbacks from the Choreographer.

Link copied to clipboard
fun transform(x: Float, sy: Float, sx: Float, y: Float, tx: Float, ty: Float)
Link copied to clipboard
fun translate(dx: Float, dy: Float)