pub struct Scale {
pub dpr: f32,
}Expand description
Device pixel ratio (DPR) for logical ↔ physical conversion.
§Examples
use ailloli_ui_core::Scale;
assert_eq!(Scale::new(2.0).dpr, 2.0);Fields§
§dpr: f32Pixels per logical unit (e.g. 2.0 on a 2× display).
Implementations§
Source§impl Scale
impl Scale
Sourcepub fn new(dpr: f32) -> Self
pub fn new(dpr: f32) -> Self
Creates a device-pixel ratio.
In optimized builds, zero and negative finite values clamp to 0.0001,
NaN follows floating-point max semantics and also becomes 0.0001,
while positive infinity remains infinite.
§Panics
Debug builds assert that dpr is finite and strictly positive.
§Examples
use ailloli_ui_core::Scale;
assert_eq!(Scale::new(1.5).dpr, 1.5);Trait Implementations§
impl Copy for Scale
impl StructuralPartialEq for Scale
Auto Trait Implementations§
impl Freeze for Scale
impl RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnwindSafe for Scale
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