Struct druid_shell::ScaledArea [−][src]
pub struct ScaledArea { /* fields omitted */ }
Expand description
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
Create a new scaled area from pixels.
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
.
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn round_from(x: T) -> T
pub fn round_from(x: T) -> T
Performs the conversion.
pub fn round_into(self) -> U
pub fn round_into(self) -> U
Performs the conversion.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more