-
- All Implemented Interfaces:
-
app.rive.core.CheckableAutoCloseable,java.lang.AutoCloseable
public final class SoftwareRenderBuffer implements CheckableAutoCloseable
CPU-backed offscreen render target for snapshot-style rendering.
Use this when you need software pixels, such as snapshot testing or CPU-side image processing. For realtime presentation on hardware-accelerated canvases, prefer HardwareRenderBuffer.
The dimensions of this buffer are fixed at construction and cannot be resized. To render at a different size, create a new buffer.
Ownership/lifecycle:
This class owns its internal render surface and must be closed.
Callers own destination bitmaps passed to renderInto; reuse a destination bitmap per size for repeated renders.
Callers should recycle destination bitmaps when they are no longer needed.
Performance:
Rendering is synchronous and includes CPU pixel conversion.
This is typically slower than HardwareRenderBuffer for continuous realtime rendering.
Threading:
renderInto is synchronous with respect to buffer population.
API level:
Available on all Android API levels supported by this runtime.
-
-
Constructor Summary
Constructors Constructor Description SoftwareRenderBuffer(Integer width, Integer height, CommandQueue riveWorker)
-
Method Summary
Modifier and Type Method Description final RiveSurfacegetSurface()Surface used for rendering and layout operations such as Artboard.resizeArtboard. BooleangetClosed()final IntegergetWidth()final IntegergetHeight()Unitclose()Closes this buffer and its owned render surface. final BitmaprenderInto(Bitmap bitmap, Artboard artboard, StateMachine stateMachine, Fit fit, Integer clearColor)Synchronously renders into bitmap. -
-
Constructor Detail
-
SoftwareRenderBuffer
SoftwareRenderBuffer(Integer width, Integer height, CommandQueue riveWorker)
- Parameters:
width- Width in pixels.height- Height in pixels.riveWorker- Worker used for drawing.
-
-
Method Detail
-
getSurface
final RiveSurface getSurface()
Surface used for rendering and layout operations such as Artboard.resizeArtboard.
-
renderInto
final Bitmap renderInto(Bitmap bitmap, Artboard artboard, StateMachine stateMachine, Fit fit, Integer clearColor)
Synchronously renders into bitmap.
- Parameters:
bitmap- Destination bitmap.artboard- Artboard to render.stateMachine- State machine to render.fit- Fit mode to use while rendering.clearColor- Clear color used before drawing.
-
-
-
-