Package 

Class HardwareRenderBuffer

  • All Implemented Interfaces:
    app.rive.core.CheckableAutoCloseable , java.lang.AutoCloseable

    @RequiresApi(value = 29) 
    public final class HardwareRenderBuffer
     implements CheckableAutoCloseable
                        

    GPU-backed offscreen render target for realtime canvas presentation (API 29+).

    Use this when you need high-throughput rendering into a hardware-accelerated Canvas without CPU pixel readback. For software pixels, snapshot testing, or CPU-side image workflows, use SoftwareRenderBuffer.

    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 an ImageReader surface and a callback thread to receive messages from it, and must be closed.

    • It is expected that there is only a single consumer using consumeLatestBitmap.

    Performance:

    • render enqueues GPU work and returns; frame publication is asynchronous.

    • Frame publication notifications are exposed via frameAvailable.

    Threading:

    • Image acquisition and hardware-buffer wrapping run on a dedicated HandlerThread.

    • render and consumeLatestBitmap are safe to call from the caller thread (typically main).

    API level:

    • Requires Android API 29+ for hardware bitmap and usage-flag support.

    • Constructor Detail

      • HardwareRenderBuffer

        HardwareRenderBuffer(Integer width, Integer height, CommandQueue riveWorker)
        Parameters:
        width - Width in pixels.
        height - Height in pixels.
        riveWorker - Worker used for draw submission.