NineTileBox class
This allows you to create a rectangle textured with a 9-sliced image.
How it works is that you have a template image in a 3x3 grid, made up of 9 tiles, and a new rectangle can be draw by keeping the 4 corners, expanding the 4 sides only in the direction in which they are located and expanding the center in both directions. That allows you to have non distorted borders.
Constructors
- NineTileBox(Sprite sprite, {int? tileSize, int? destTileSize})
- Creates a nine-box instance.
- NineTileBox.withGrid(Sprite sprite, {double leftWidth = 0.0, double rightWidth = 0.0, double topHeight = 0.0, double bottomHeight = 0.0})
- Creates a nine-box instance with the specified grid size
Properties
- center ↔ Rect
-
getter/setter pair
- destTileSize ↔ int
-
The size each tile becomes when rendered
(optionally used to scale the src image).
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sprite → Sprite
-
The sprite used to render the box, must be a 3x3 grid of square tiles.
final
- tileSize → int
-
The size of each tile in the source sprite image.
final
Methods
-
draw(
Canvas c, Vector2 position, Vector2 size) → void -
Renders this nine box as a rectangle at
position
with sizesize
. -
drawRect(
Canvas c, [Rect? dst]) → void -
Renders this nine box with the dimensions provided by
dst
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setGrid(
{double? leftWidth, double? rightWidth, double? topHeight, double? bottomHeight}) → void - Set different sizes for each of the fixed size rows and columns
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited