[−][src]Struct piet_common::RadialGradient
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
impl RadialGradient[src]
pub fn new(radius: f64, stops: impl GradientStops) -> RadialGradient[src]
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.
pub fn with_center(self, center: UnitPoint) -> RadialGradient[src]
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.
pub fn with_origin(self, origin: UnitPoint) -> RadialGradient[src]
A builder-style method for changing the origin of the gradient.
See the main RadialGradient docs for an explanation of center vs. origin.
pub fn with_scale_mode(self, scale_mode: ScaleMode) -> RadialGradient[src]
A builder-style method for changing the ScaleMode of the gradient.
Trait Implementations
impl Clone for RadialGradient[src]
fn clone(&self) -> RadialGradient[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for RadialGradient[src]
impl From<RadialGradient> for PaintBrush[src]
fn from(src: RadialGradient) -> PaintBrush[src]
impl<P> IntoBrush<P> for RadialGradient where
P: RenderContext, [src]
P: RenderContext,
fn make_brush(
&'a self,
piet: &mut P,
bbox: impl FnOnce() -> Rect
) -> Cow<'a, <P as RenderContext>::Brush>[src]
&'a self,
piet: &mut P,
bbox: impl FnOnce() -> Rect
) -> Cow<'a, <P as RenderContext>::Brush>
Auto Trait Implementations
impl RefUnwindSafe for RadialGradient
impl Send for RadialGradient
impl Sync for RadialGradient
impl Unpin for RadialGradient
impl UnwindSafe for RadialGradient
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[src]
fn round_from(x: T) -> T[src]
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>, [src]
U: RoundFrom<T>,
fn round_into(self) -> U[src]
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>,