TextureResource

constructor(path: String, loadType: LoadType = LoadType.FROM_ASSETS, option: TextureCreateOption = TextureCreateOption())

Constructs a TextureResource from a file path.

Parameters

path

The file path of the texture.

loadType

The loading method; defaults to FROM_ASSETS.

option

Options for creating the texture resource.

Throws

If an error occurs during the loading process.


constructor(path: String, loadType: LoadType = LoadType.FROM_ASSETS)

Constructs a TextureResource from a file path.

Parameters

path

The file path of the texture.

loadType

The loading method; defaults to FROM_ASSETS.

Throws

If an error occurs during the loading process.


constructor(bitmap: Bitmap)

Creates a TextureResource from a 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: Do not modify the bitmap while creating the texture resource.

Return

The created TextureResource.

Parameters

bitmap

The source bitmap.

Throws

If an error occurs during the loading process.

IllegalArgumentException

If the bitmap has an unsupported format.