#[repr(C)]pub struct Tile {
pub packed_winding_line_idx: u32,
pub x: u16,
pub y: u16,
}
Expand description
A tile represents an aligned area on the pixmap, used to subdivide the viewport into sub-areas (currently 4x4) and analyze line intersections inside each such area.
Keep in mind that it is possible to have multiple tiles with the same index, namely if we have multiple lines crossing the same 4x4 area!
§Note
This struct is #[repr(C)]
, but the byte order of its fields is dependent on the endianness of
the compilation target.
Fields§
§packed_winding_line_idx: u32
The index of the line this tile belongs to into the line buffer, plus whether the line crosses the top edge of the tile, packed together.
The index is the unsigned number in the 31 least significant bits of this value.
The last bit is 1 if and only if the lines crosses the tile’s top edge. Lines making this crossing increment or decrement the coarse tile winding, depending on the line direction.
x: u16
The index of the tile in the x direction.
y: u16
The index of the tile in the y direction.
Implementations§
Source§impl Tile
impl Tile
Sourcepub const fn new(x: u16, y: u16, line_idx: u32, winding: bool) -> Self
pub const fn new(x: u16, y: u16, line_idx: u32, winding: bool) -> Self
Create a new tile.
line_idx
must be smaller than MAX_LINES_PER_PATH
.
Sourcepub const fn same_loc(&self, other: &Self) -> bool
pub const fn same_loc(&self, other: &Self) -> bool
Check whether two tiles are at the same location.
Sourcepub const fn prev_loc(&self, other: &Self) -> bool
pub const fn prev_loc(&self, other: &Self) -> bool
Check whether self
is adjacent to the left of other
.
Sourcepub const fn same_row(&self, other: &Self) -> bool
pub const fn same_row(&self, other: &Self) -> bool
Check whether two tiles are on the same row.
Sourcepub const fn line_idx(&self) -> u32
pub const fn line_idx(&self) -> u32
The index of the line this tile belongs to into the line buffer.