fromRGBABytes

fun fromRGBABytes(pixelBytes: ByteArray, width: Int, height: Int, rendererType: RendererType = Rive.defaultRendererType, premultiplied: Boolean = true): RiveRenderImage

Creates a RiveRenderImage from RGBA8888 pixel bytes.

The byte array must be exactly width * height * 4 bytes.

The caller is in charge of the ownership of this NativeObject. It must be freed by calling release.

Return

The constructed RiveRenderImage.

Parameters

pixelBytes

RGBA8888 pixel bytes.

width

The width of the image in pixels.

height

The height of the image in pixels.

rendererType

The renderer for this image. This must match the renderer for the RiveAnimationView using this.

premultiplied

Whether your RGB pixels are already multiplied by alpha. If false, the native layer will premultiply RGB by alpha for you. Defaults to true as Rive expects premultiplied input.

Throws

if the pixel array is not the correct size.