#[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: u32The 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: u16The index of the tile in the x direction.
y: u16The index of the tile in the y direction.
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn new_clamped(x: u16, y: u16, line_idx: u32, winding: bool) -> Self
pub fn new_clamped(x: u16, y: u16, line_idx: u32, winding: bool) -> Self
Create a new tile.
x and y will be clamped to the largest possible coordinate if they are too large.
line_idx must be smaller than MAX_LINES_PER_PATH.
pub(crate) const fn new(x: u16, y: u16, line_idx: u32, winding: bool) -> Self
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.
Trait Implementations§
Source§impl Ord for Tile
impl Ord for Tile
Source§impl PartialOrd for Tile
impl PartialOrd for Tile
impl Copy for Tile
impl Eq for Tile
Auto Trait Implementations§
impl Freeze for Tile
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnwindSafe for Tile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.