pub struct OverlayTransform { /* private fields */ }Expand description
A uniform similarity transform mapping the reference canvas to the live window: a single scale plus a recentering. Built from the live viewport; an invalid (zero) viewport yields the identity (overlay drawn at reference pixels), which is what unit tests and the pre-backend init frames see.
Implementations§
Source§impl OverlayTransform
impl OverlayTransform
Sourcepub fn from_viewport(viewport: [f32; 2]) -> Self
pub fn from_viewport(viewport: [f32; 2]) -> Self
Build the transform for a live logical viewport [width, height]. A
degenerate viewport gives the identity transform.
Sourcepub fn cover_from_viewport(viewport: [f32; 2]) -> Self
pub fn cover_from_viewport(viewport: [f32; 2]) -> Self
Build the “cover” transform for a live logical viewport: the larger axis ratio, so the reference canvas always fills the window (the overflowing axis is cropped equally on both sides). Used by full-bleed stage imagery (scene backdrops, character portraits) that must reach the window edges without distorting; the canvas bottom maps at or below the window bottom, so bottom-anchored content stays flush at any aspect ratio.
Sourcepub fn bottom_anchored_from_viewport(viewport: [f32; 2]) -> Self
pub fn bottom_anchored_from_viewport(viewport: [f32; 2]) -> Self
Build the “bottom-anchored” transform for a live logical viewport: the
fit scale (no cropping, elements keep their proportions), but shifted
vertically so the reference bottom edge (y = reference height) maps to the
window bottom. Bottom-anchored overlay furniture (a dialog box and its
controls) hugs the window bottom at any aspect ratio, where a plain fit
would float it above the letterbox margin.
Sourcepub fn scale(&self) -> f32
pub fn scale(&self) -> f32
The uniform scale factor applied to sizes (glyph scale, sprite extent).
Trait Implementations§
Source§impl Clone for OverlayTransform
impl Clone for OverlayTransform
Source§fn clone(&self) -> OverlayTransform
fn clone(&self) -> OverlayTransform
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more