-
- All Implemented Interfaces:
-
app.rive.AssetOps
public class ImageAsset.Companion implements AssetOps<ImageHandle, ImageAsset>
-
-
Method Summary
Modifier and Type Method Description final Result<ImageAsset>fromBytes(CommandQueue riveWorker, ByteArray bytes)Create and decode an image asset from the given byte array on the provided Rive worker. ImageHandledecode(CommandQueue worker, ByteArray bytes)Decode the asset from the given byte array on the provided Rive worker. Unitdelete(CommandQueue worker, ImageHandle handle)Delete the asset from the provided Rive worker. Unitregister(CommandQueue worker, String key, ImageHandle handle)Register the asset with the provided Rive worker under the given key. Unitunregister(CommandQueue worker, String key)Unregister the asset from the provided Rive worker for the given key. ImageAssetconstruct(ImageHandle handle, CommandQueue worker)Construct the asset instance from the given handle, key, and Rive worker. StringgetTag()The tag used for logging purposes. StringgetLabel()A label for the asset type, used in logging. -
-
Method Detail
-
fromBytes
final Result<ImageAsset> fromBytes(CommandQueue riveWorker, ByteArray bytes)
Create and decode an image asset from the given byte array on the provided Rive worker.
The image can only be used on the same RiveWorker it was created on.
Must be registered with ImageAsset.register to be used for referenced images.
⚠️ The lifetime of the returned image is managed by the caller. Make sure to call close when you are done with it to release its resources.
- Parameters:
riveWorker- The Rive worker that owns the image.bytes- The byte array containing the image data to decode.
-
decode
ImageHandle decode(CommandQueue worker, ByteArray bytes)
Decode the asset from the given byte array on the provided Rive worker.
-
delete
Unit delete(CommandQueue worker, ImageHandle handle)
Delete the asset from the provided Rive worker.
-
register
Unit register(CommandQueue worker, String key, ImageHandle handle)
Register the asset with the provided Rive worker under the given key.
-
unregister
Unit unregister(CommandQueue worker, String key)
Unregister the asset from the provided Rive worker for the given key.
-
construct
ImageAsset construct(ImageHandle handle, CommandQueue worker)
Construct the asset instance from the given handle, key, and Rive worker.
-
-
-
-