Struct kas_core::layout::LogicalSize
source · [−]Expand description
Logical (pre-scaling) pixel size
A measure of size in “logical pixels”. May be used to define scalable layouts.
Tuple Fields
0: f321: f32Implementations
sourceimpl LogicalSize
impl LogicalSize
sourcepub fn to_physical(self, scale_factor: f32) -> Size
pub fn to_physical(self, scale_factor: f32) -> Size
Convert to physical pixels
Values are multiplied by the window’s scale factor and cast to nearest.
sourcepub fn to_rules(self, dir: impl Directional, scale_factor: f32) -> SizeRules
pub fn to_rules(self, dir: impl Directional, scale_factor: f32) -> SizeRules
Convert to SizeRules, fixed size
sourcepub fn to_rules_with_factor(
self,
dir: impl Directional,
scale_factor: f32,
ideal_factor: f32
) -> SizeRules
pub fn to_rules_with_factor(
self,
dir: impl Directional,
scale_factor: f32,
ideal_factor: f32
) -> SizeRules
Convert to SizeRules
Ideal size is component * ideal_factor * scale_factor.
sourcepub fn extract(self, dir: impl Directional) -> f32
pub fn extract(self, dir: impl Directional) -> f32
Take horizontal/vertical axis component
sourcepub fn extract_scaled(self, dir: impl Directional, scale_factor: f32) -> i32
pub fn extract_scaled(self, dir: impl Directional, scale_factor: f32) -> i32
Take component and scale
Trait Implementations
sourceimpl Clone for LogicalSize
impl Clone for LogicalSize
sourcefn clone(&self) -> LogicalSize
fn clone(&self) -> LogicalSize
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Conv<(i32, i32)> for LogicalSize
impl Conv<(i32, i32)> for LogicalSize
sourceimpl Conv<(u32, u32)> for LogicalSize
impl Conv<(u32, u32)> for LogicalSize
sourceimpl Conv<Size> for LogicalSize
impl Conv<Size> for LogicalSize
sourceimpl Debug for LogicalSize
impl Debug for LogicalSize
sourceimpl Default for LogicalSize
impl Default for LogicalSize
sourcefn default() -> LogicalSize
fn default() -> LogicalSize
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for LogicalSize
impl<'de> Deserialize<'de> for LogicalSize
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<(f32, f32)> for LogicalSize
impl From<(f32, f32)> for LogicalSize
sourceimpl From<LogicalSize> for Vec2
impl From<LogicalSize> for Vec2
sourcefn from(LogicalSize: LogicalSize) -> Self
fn from(LogicalSize: LogicalSize) -> Self
Converts to this type from the input type.
sourceimpl From<Vec2> for LogicalSize
impl From<Vec2> for LogicalSize
sourceimpl PartialEq<LogicalSize> for LogicalSize
impl PartialEq<LogicalSize> for LogicalSize
sourcefn eq(&self, other: &LogicalSize) -> bool
fn eq(&self, other: &LogicalSize) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourceimpl Serialize for LogicalSize
impl Serialize for LogicalSize
impl Copy for LogicalSize
impl StructuralPartialEq for LogicalSize
Auto Trait Implementations
impl RefUnwindSafe for LogicalSize
impl Send for LogicalSize
impl Sync for LogicalSize
impl Unpin for LogicalSize
impl UnwindSafe for LogicalSize
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
sourcefn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Try approximate conversion from Self to T Read more
sourcefn cast_approx(self) -> T
fn cast_approx(self) -> T
Cast approximately from Self to T Read more
sourceimpl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
sourcefn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
sourcefn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
sourcefn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
sourcefn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
sourcefn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
sourcefn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
sourcefn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more
sourceimpl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
sourcefn try_conv_approx(x: S) -> Result<T, Error>
fn try_conv_approx(x: S) -> Result<T, Error>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: S) -> T
fn conv_approx(x: S) -> T
Converting from T to Self, allowing approximation of value Read more