[]Struct druid::LinearGradient

pub struct LinearGradient { /* fields omitted */ }

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

The start and end points in the gradient are given in UnitPoint coordinates, which are then resolved to image-space coordinates for any given concrete Rect.

When the fixed coordinates are known, use FixedLinearGradient instead.

Methods

impl LinearGradient

pub fn new(
    start: UnitPoint,
    end: UnitPoint,
    stops: impl GradientStops
) -> LinearGradient

Create a new linear gradient.

The start and end coordinates are UnitPoint coordinates, relative to the geometry of the shape being drawn.

Examples

use piet::{Color, RenderContext, LinearGradient, UnitPoint};
use piet::kurbo::{Circle, Point};

let circle = Circle::new(Point::new(100.0, 100.0), 50.0);
let gradient = LinearGradient::new(
    UnitPoint::TOP,
    UnitPoint::BOTTOM,
    (Color::WHITE, Color::BLACK)
);
render_ctx.fill(circle, &gradient);

Trait Implementations

impl Clone for LinearGradient

impl Debug for LinearGradient

impl From<LinearGradient> for PaintBrush

impl Into<Value> for LinearGradient[src]

impl<P> IntoBrush<P> for LinearGradient where
    P: RenderContext

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.