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