indigo
indigo copied to clipboard
Cropped Graphics don't tile
When defining a Graphic
and withCrop
means you cannot tile a graphic. For example, for a 16x16 portion of an image the following should tile the entire area, but doesn't:
Graphic(128, 16, Material.Bitmap(AssetName("sprite")).tile)
.withCrop(16, 0)
The problem here is that in a Graphic
, the size
and the crop
rectangles are the same thing. So when you set a crop on some sub-section of the graphic, you're actually setting the size of the graphic, and the tile works perfectly because there is only room for one iteration.
This is not the expected behaviour, but there are two ways forward:
- Find some way to express that size and crop are different, currently there is no way to represent this in the data.
- Simply say that it's a limitation: Tiling doesn't work on cropped graphics. Doesn't feel great though.
Interesting side note, in the current implementation, the crop size is the size of the space on the screen and the crop position becomes a tiling offset value! Bug or feature... bug or feature... :thinking: