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.

Returns the scaled area size in display points.

Returns the scaled area size in pixels.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

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