pub struct Offset {
pub dx: i16,
pub dy: i16,
}Expand description
A sub-cell pixel offset (dx, dy), distinct from Pos so a caller can’t transpose a
position and an offset in a call like Surface::put_offset.
Visual only: an offset shifts where a glyph is painted within its cell on backends that
support sub-cell placement (e.g. retroglyph-software); it never changes which cell a glyph
occupies, and cell-mode backends (e.g. retroglyph-crossterm) ignore it entirely.
This crate’s serde feature adds Serialize/Deserialize impls for Offset directly (unlike
Size/Pos/Rect, which forward to ixy’s own serde feature).
§Examples
use retroglyph_core::grid::Offset;
let offset = Offset::new(3, -2);
assert_eq!(offset.dx, 3);
assert_eq!(offset.dy, -2);Fields§
§dx: i16Horizontal pixel offset.
dy: i16Vertical pixel offset.
Implementations§
Trait Implementations§
impl Copy for Offset
Source§impl<'de> Deserialize<'de> for Offset
impl<'de> Deserialize<'de> for Offset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Offset
impl StructuralPartialEq for Offset
Auto Trait Implementations§
impl Freeze for Offset
impl RefUnwindSafe for Offset
impl Send for Offset
impl Sync for Offset
impl Unpin for Offset
impl UnsafeUnpin for Offset
impl UnwindSafe for Offset
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
Mutably borrows from an owned value. Read more