create

@JvmStatic
fun create(bitmap: Bitmap): TextureResource

Asynchronously create texture resource from bitmap.

Only a part of format is supported now:

  • Bitmap.Config.ARGB_8888

  • Bitmap.Config.RGBA_F16

If a Bitmap with unsupported format is given, an IllegalArgumentException will be thrown.

Note that, you shouldn't modify this bitmap during creating texture resource.

Return

The TextureResource which load.

Parameters

bitmap

The given bitmap.

Throws

If an error occurs during the loading process.

IllegalArgumentException

If the bitmap has an unsupported format.

Note: For complex or high-resolution resources that require significant processing time, it is strongly recommended to leverage coroutines for loading. This approach prevents blocking the main thread, ensuring a responsive and fluid user experience.