pub struct ScaleFactor(/* private fields */);Expand description
The ratio of physical device pixels to logical pixels for a surface
(e.g. 2.0 on a typical HiDPI “retina” display, 1.0 on a standard
display). Always strictly positive.
Implementations§
Source§impl ScaleFactor
impl ScaleFactor
Sourcepub fn new(factor: f64) -> Self
pub fn new(factor: f64) -> Self
Creates a scale factor, clamping non-finite or non-positive input to
ScaleFactor::IDENTITY.
pub fn get(self) -> f64
Sourcepub fn to_physical(self, logical: Size) -> PhysicalSize
pub fn to_physical(self, logical: Size) -> PhysicalSize
Convert a logical size to physical pixels, rounding to whole pixels.
Sourcepub fn to_logical(self, physical: PhysicalSize) -> Size
pub fn to_logical(self, physical: PhysicalSize) -> Size
Convert a physical size back to logical pixels.
Trait Implementations§
Source§impl Clone for ScaleFactor
impl Clone for ScaleFactor
Source§fn clone(&self) -> ScaleFactor
fn clone(&self) -> ScaleFactor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ScaleFactor
Source§impl Debug for ScaleFactor
impl Debug for ScaleFactor
Source§impl Default for ScaleFactor
impl Default for ScaleFactor
Source§impl PartialEq for ScaleFactor
impl PartialEq for ScaleFactor
Source§fn eq(&self, other: &ScaleFactor) -> bool
fn eq(&self, other: &ScaleFactor) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ScaleFactor
Auto Trait Implementations§
impl Freeze for ScaleFactor
impl RefUnwindSafe for ScaleFactor
impl Send for ScaleFactor
impl Sync for ScaleFactor
impl Unpin for ScaleFactor
impl UnsafeUnpin for ScaleFactor
impl UnwindSafe for ScaleFactor
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