[−][src]Struct piet_common::LinearGradient
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[src]
pub fn new<impl GradientStops>(
start: UnitPoint,
end: UnitPoint,
stops: impl GradientStops
) -> LinearGradient where
impl GradientStops: GradientStops, [src]
start: UnitPoint,
end: UnitPoint,
stops: impl GradientStops
) -> LinearGradient where
impl GradientStops: GradientStops,
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 From<LinearGradient> for PaintBrush[src]
fn from(src: LinearGradient) -> PaintBrush[src]
impl Debug for LinearGradient[src]
impl<P> IntoBrush<P> for LinearGradient where
P: RenderContext, [src]
P: RenderContext,
fn make_brush<impl FnOnce() -> Rect>(
&'a self,
piet: &mut P,
bbox: impl FnOnce() -> Rect
) -> Cow<'a, <P as RenderContext>::Brush> where
impl FnOnce() -> Rect: FnOnce() -> Rect, [src]
&'a self,
piet: &mut P,
bbox: impl FnOnce() -> Rect
) -> Cow<'a, <P as RenderContext>::Brush> where
impl FnOnce() -> Rect: FnOnce() -> Rect,
impl Clone for LinearGradient[src]
fn clone(&self) -> LinearGradient[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl Sync for LinearGradient
impl Unpin for LinearGradient
impl Send for LinearGradient
impl UnwindSafe for LinearGradient
impl RefUnwindSafe for LinearGradient
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
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> From<T> for 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
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> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
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>,