pub struct PhysicalSize {
pub width: u32,
pub height: u32,
}
Expand description
A size represented in the coordinate space of physical device pixels. That is the space after applying a display device specific scale factor to pixels from the logical coordinate space.
Fields§
§width: u32
The width in physical pixels.
height: u32
The height in physical pixels;
Implementations§
Source§impl PhysicalSize
impl PhysicalSize
Sourcepub const fn new(width: u32, height: u32) -> Self
pub const fn new(width: u32, height: u32) -> Self
Construct a new physical size from the width and height values, that are assumed to be in the physical coordinate space.
Sourcepub fn from_logical(logical_size: LogicalSize, scale_factor: f32) -> Self
pub fn from_logical(logical_size: LogicalSize, scale_factor: f32) -> Self
Convert a given logical size to a physical size by multiplying width and height with the specified scale factor.
Sourcepub fn to_logical(&self, scale_factor: f32) -> LogicalSize
pub fn to_logical(&self, scale_factor: f32) -> LogicalSize
Convert this physical size to a logical size by dividing width and height by the specified scale factor.
Trait Implementations§
Source§impl Clone for PhysicalSize
impl Clone for PhysicalSize
Source§fn clone(&self) -> PhysicalSize
fn clone(&self) -> PhysicalSize
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PhysicalSize
impl Debug for PhysicalSize
Source§impl Default for PhysicalSize
impl Default for PhysicalSize
Source§fn default() -> PhysicalSize
fn default() -> PhysicalSize
Returns the “default value” for a type. Read more
Source§impl From<PhysicalSize> for WindowSize
impl From<PhysicalSize> for WindowSize
Source§fn from(value: PhysicalSize) -> Self
fn from(value: PhysicalSize) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PhysicalSize
impl PartialEq for PhysicalSize
impl Copy for PhysicalSize
impl Eq for PhysicalSize
impl StructuralPartialEq for PhysicalSize
Auto Trait Implementations§
impl Freeze for PhysicalSize
impl RefUnwindSafe for PhysicalSize
impl Send for PhysicalSize
impl Sync for PhysicalSize
impl Unpin for PhysicalSize
impl UnwindSafe for PhysicalSize
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