pub struct WindowSize {
pub physical: PhysicalSize<u32>,
pub logical: LogicalSize<f64>,
pub scale_factor: f64,
}Expand description
A window’s size, which can be read in either logical or physical pixels.
Methods that produce this type in baseview guarantee that either the physical or the logical size is directly from the underlying platform API.
This means that for either of the size types, there is at most only one conversion performed, which minimizes errors that may occur due to rounding.
Fields§
§physical: PhysicalSize<u32>The window’s size in physical pixels.
logical: LogicalSize<f64>The window’s size in logical pixels.
scale_factor: f64The backing scale factor of the window.
This is the value used to convert between the physical and logical sizes.
Implementations§
Source§impl WindowSize
impl WindowSize
Sourcepub fn from_physical(physical: PhysicalSize<u32>, scale_factor: f64) -> Self
pub fn from_physical(physical: PhysicalSize<u32>, scale_factor: f64) -> Self
Constructs a WindowSize from a given PhysicalSize and scale_factor.
The LogicalSize is converted from the given physical size, using the given scale factor.
Sourcepub fn from_logical(logical: LogicalSize<f64>, scale_factor: f64) -> Self
pub fn from_logical(logical: LogicalSize<f64>, scale_factor: f64) -> Self
Constructs a WindowSize from a given LogicalSize and scale_factor.
The PhysicalSize is converted from the given physical size, using the given scale factor.