A texture represents a rectangular area of an image and is typically used to draw a sprite to the screen.

Normally you get a reference to a texture from a SpriteSheet, but you can also create one from an Image.

Constructors

Texture(Image image)

Creates a new texture from an Image object.

Properties

frame Rect

The frame of the trimmed texture inside the image.

read-only
hashCode int

Get a hash code for this object.

read-only, inherited
image Image

The image that this texture is a part of.

read-only
name String

The name of the image acts as a tag when acquiring a reference to it.

read / write
pivot Point

The default pivot point for this texture. When creating a Sprite from the texture, this is the pivot point that will be used.

read / write
rotated bool

The texture was rotated 90 degrees when being packed into a sprite sheet.

read-only
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited
size Size

The logical size of the texture, before being trimmed by the texture packer.

read-only
spriteSourceSize Rect

The offset and size of the trimmed texture inside the image.

read-only
trimmed bool

The texture was trimmed when being packed into a sprite sheet.

read-only

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

drawTexture(Canvas canvas, Point position, Paint paint) → void

Draws the texture to a Canvas at a specified position and with the specified paint.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
textureFromRect(Rect rect, [ String name = null ]) Texture

Creates a new Texture from a part of the current texture.

toString() String

Returns a string representation of this object.

inherited