[−][src]Struct druid_shell::ScaledArea
A specific area scaling state.
This holds the platform area size in pixels and the logical area size in display points.
The platform area size in pixels tends to be limited to integers and ScaledArea
works
under that assumption.
The logical area size in display points is an unrounded conversion, which means that it is
often not limited to integers. This allows for accurate calculations of
the platform area pixel boundaries from the logical area using a Scale
.
Even though the logical area size can be fractional, the integer boundaries of that logical area will still match up with the platform area pixel boundaries as often as the scale factor allows.
A copy of ScaledArea
will be stale as soon as the platform area size changes.
Implementations
impl ScaledArea
[src]
pub fn from_px<T: Into<Size>>(size: T, scale: &Scale) -> ScaledArea
[src]
Create a new scaled area from pixels.
pub fn from_dp<T: Into<Size>>(size: T, scale: &Scale) -> ScaledArea
[src]
Create a new scaled area from display points.
The calculated size in pixels is rounded away from zero to integers.
That means that the scaled area size in display points isn't always the same
as the size
given to this function. To find out the new size in points use size_dp
.
pub fn size_dp(&self) -> Size
[src]
Returns the scaled area size in display points.
pub fn size_px(&self) -> Size
[src]
Returns the scaled area size in pixels.
Trait Implementations
impl Clone for ScaledArea
[src]
fn clone(&self) -> ScaledArea
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for ScaledArea
[src]
impl Debug for ScaledArea
[src]
impl Default for ScaledArea
[src]
fn default() -> ScaledArea
[src]
impl PartialEq<ScaledArea> for ScaledArea
[src]
fn eq(&self, other: &ScaledArea) -> bool
[src]
fn ne(&self, other: &ScaledArea) -> bool
[src]
impl StructuralPartialEq for ScaledArea
[src]
Auto Trait Implementations
impl RefUnwindSafe for ScaledArea
impl Send for ScaledArea
impl Sync for ScaledArea
impl Unpin for ScaledArea
impl UnwindSafe for ScaledArea
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
fn round_into(self) -> U
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,