gridBySize method
Implementation
List<Rect> gridBySize(int cellSize) {
final textures = <Rect>[];
final horizontalCount = width ~/ cellSize;
final verticalCount = height ~/ cellSize;
for (int i = 0; i < horizontalCount; i++) {
for (int j = 0; j < verticalCount; j++) {
final rect = Rect.fromLTWH(
left + i * cellSize,
top + j * cellSize,
cellSize.toDouble(),
cellSize.toDouble(),
);
textures.add(rect);
}
}
return textures;
}