Texture class Graphics
Represents a Texture. Textures are reference-counted; use retain and dispose to manage their lifecycle.
Constructors
Properties
- flags ↔ int
-
The bitmask TextureFlags applied to this texture.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ int
-
The height of the texture in pixels.
getter/setter pair
- isLoading ↔ bool
-
true
if the texture is currently loading its data,false
otherwise.getter/setter pair - pixelData ↔ Uint8List
-
The raw pixel data of the texture as a
Uint8List
. This data is available after the texture has loaded.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- texture ↔ WebGLTexture?
-
getter/setter pair
- width ↔ int
-
The width of the texture in pixels.
getter/setter pair
Methods
-
dispose(
) → void - Decrements the reference count of this texture. If the reference count reaches zero, the texture is deleted, and any onDispose callbacks are triggered. Logs an error if the reference count is already zero or less.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
dynamic func(Texture texture)) → void - Registers a callback function to be executed when the texture is disposed (i.e., its reference count reaches zero and the WebGL texture is deleted).
-
onLoad(
dynamic func(Texture texture)) → void -
Registers a callback function to be executed when the texture has finished loading.
If the texture is already loaded (isLoading is
false
), the callback is executed immediately. -
retain(
) → void - Increments the reference count of this texture. Call this if you are keeping an additional reference to the texture elsewhere to prevent premature disposal.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateTextureData(
Uint8List data) → void -
Updates the texture's pixel data on the GPU with the provided
data
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
Static Methods
-
create(
{required GL2 gl, Uint8List? pixelData, int width = 1, int height = 1, int textureFlags = TextureFlags.defaultFlags}) → Texture - Creates a Texture from raw pixel data or as an empty texture.
-
createWhite(
GL2 gl) → Texture - Creates and returns a 1x1 opaque white Texture.
-
load(
GL2 gl, Loader loadingInfo, dynamic path, [int textureFlags = TextureFlags.defaultFlags]) → Texture -
Asynchronously loads a Texture from the specified
path
.