pub struct RadialGradient { /* private fields */ }
Expand description

A description of a radial gradient in the unit rect, which can be resolved to a fixed gradient.

The center and origin are given in UnitPoint coordinates.

The center parameter specifies the center of the circle, so that points of distance radius from the center map to 1.0 in the gradient stops. The origin parameter specifies the point that maps to 0.0 in the gradient stops. Using the same origin and center gives a radially symmetric gradient; using different points is useful for simulating lighting effects. See configuring a radial gradient for a fuller explanation.

By default, origin and center are both at the center (0.5, 0.5) point. This can be changed during construction with the with_center and with_origin builder methods.

The ScaleMode describes how the gradient is mapped to a non-square rectangle; by default this will expand on the longest axis, but this can be changed with the with_scale_mode builder method.

Implementations

Creates a simple RadialGradient. This gradient has origin and center set to (0.5, 0.5), and uses the Fill ScaleMode. These attributes can be modified with the with_center, with_origin, and with_scale_mode builder methods.

A builder-style method for changing the center of the gradient. This does not change the origin; in the common case, you will want to change both values.

See the main RadialGradient docs for an explanation of center vs. origin.

A builder-style method for changing the origin of the gradient.

See the main RadialGradient docs for an explanation of center vs. origin.

A builder-style method for changing the ScaleMode of the gradient.

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
Converts to this type from the input type.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Performs the conversion.
Performs the conversion.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.