NineTileBox constructor

NineTileBox(
  1. Sprite sprite,
  2. {int tileSize,
  3. int destTileSize}
)

Creates a nine-box instance.

sprite is the 3x3 grid and tileSize is the size of each tile. The src sprite must 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}) {
  this.tileSize = tileSize ?? sprite.src.width.toInt();
  this.destTileSize = destTileSize ?? tileSize;
}