NineTileBox constructor
Creates a nine-box instance.
sprite is the 3x3 grid and tileSize is the size of each tile.
The src sprite must be a square of size 3*tileSize.
If tileSize is not provided, the width of the sprite is assumed as the
size. Otherwise the width and height properties of the sprite are ignored.
If destTileSize is not provided, the evaluated tileSize is used
instead (so no scaling happens).
Implementation
NineTileBox(this.sprite, {int? tileSize, int? destTileSize})
: tileSize = tileSize ?? sprite.src.width ~/ 3 {
this.destTileSize = destTileSize ?? this.tileSize;
final centerEdge = this.tileSize.toDouble();
center = Rect.fromLTWH(centerEdge, centerEdge, centerEdge, centerEdge);
_dst = Rect.fromLTWH(0, 0, this.destTileSize * 3, this.destTileSize * 3);
}