pub struct TileGrid {
pub top_left: Point,
pub size: Size,
/* private fields */
}Expand description
A rectangular body area split into a grid of columns × rows tiles.
top_left and size describe the rectangle in screen coordinates; callers
specify how many tile columns and rows to split it into, and the per-tile
size is derived with ceiling division (tile_width /
tile_height). The final column and row are clipped to
the rectangle’s right and bottom edges.
Fields§
§top_left: Point§size: SizeImplementations§
Source§impl TileGrid
impl TileGrid
Sourcepub const fn new(
top_left: Point,
size: Size,
columns: usize,
rows: usize,
) -> Self
pub const fn new( top_left: Point, size: Size, columns: usize, rows: usize, ) -> Self
Build a grid splitting size into columns × rows tiles.
Const-asserts that the counts are positive and do not exceed the rectangle’s
pixel dimensions, so an over-fine grid fails to compile. See
CydDisplay::tiles for the canonical draw loop that consumes the grid.
Sourcepub const fn tile_width(&self) -> usize
pub const fn tile_width(&self) -> usize
Nominal tile width: the rectangle width divided by the column count, rounded up.
Sourcepub const fn tile_height(&self) -> usize
pub const fn tile_height(&self) -> usize
Nominal tile height: the rectangle height divided by the row count, rounded up.
Sourcepub const fn max_tile_pixel_count(&self) -> usize
pub const fn max_tile_pixel_count(&self) -> usize
Largest pixel count any single tile can have.
The biggest tile is the top-left one, whose dimensions are the derived tile size clipped to the rectangle (in case the rectangle is smaller than one tile).