pub struct GeometricBlock {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}Expand description
Represents a geometric block that can be rendered as a colored rectangle
Fields§
§x: f32Normalized X position within cell (0.0 = left edge, 1.0 = right edge)
y: f32Normalized Y position within cell (0.0 = top edge, 1.0 = bottom edge)
width: f32Normalized width within cell (0.0 to 1.0)
height: f32Normalized height within cell (0.0 to 1.0)
Implementations§
Source§impl GeometricBlock
impl GeometricBlock
pub const fn new(x: f32, y: f32, width: f32, height: f32) -> Self
Sourcepub fn to_pixel_rect(
self,
cell_x: f32,
cell_y: f32,
cell_w: f32,
cell_h: f32,
) -> PixelRect
pub fn to_pixel_rect( self, cell_x: f32, cell_y: f32, cell_w: f32, cell_h: f32, ) -> PixelRect
Convert to pixel coordinates given cell bounds
Sourcepub fn to_snapped_rect(self, x0: f32, x1: f32, y0: f32, y1: f32) -> PixelRect
pub fn to_snapped_rect(self, x0: f32, x1: f32, y0: f32, y1: f32) -> PixelRect
Convert to pixel coordinates within a pixel-snapped cell, rounding every edge to the pixel grid.
Block characters that share a cell-boundary edge (█ next to ▀/▄, two adjacent █ cells, blocks over a bg-pipeline cell fill) must agree on that edge’s pixel exactly, or mixed encodings — QR codes, charts, TUI fills — render with per-character width differences. Rounding the derived edges gives all such quads the same shared boundary; never combine this with bleed extensions, which overlap the neighboring cell instead.
Trait Implementations§
Source§impl Clone for GeometricBlock
impl Clone for GeometricBlock
impl Copy for GeometricBlock
Auto Trait Implementations§
impl Freeze for GeometricBlock
impl RefUnwindSafe for GeometricBlock
impl Send for GeometricBlock
impl Sync for GeometricBlock
impl Unpin for GeometricBlock
impl UnsafeUnpin for GeometricBlock
impl UnwindSafe for GeometricBlock
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more