pub struct LinearGradient {
pub start: UnitPoint,
pub end: UnitPoint,
pub stops: Vec<(f64, Color)>,
}Expand description
A linear gradient (docs/shapes.md §3.2 / §7): color stops along the line from start to
end, both in the unit space of the filled shape’s bounding box. Stops are
(offset 0..=1, color), ascending.
Fields§
§start: UnitPoint§end: UnitPoint§stops: Vec<(f64, Color)>Implementations§
Source§impl LinearGradient
impl LinearGradient
pub fn new( start: UnitPoint, end: UnitPoint, stops: Vec<(f64, Color)>, ) -> LinearGradient
Sourcepub fn vertical(top: Color, bottom: Color) -> LinearGradient
pub fn vertical(top: Color, bottom: Color) -> LinearGradient
Top-to-bottom between two colors — the everyday sky/backdrop case.
Sourcepub fn horizontal(leading: Color, trailing: Color) -> LinearGradient
pub fn horizontal(leading: Color, trailing: Color) -> LinearGradient
Leading-to-trailing between two colors.
Trait Implementations§
Source§impl Clone for LinearGradient
impl Clone for LinearGradient
Source§fn clone(&self) -> LinearGradient
fn clone(&self) -> LinearGradient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinearGradient
impl Debug for LinearGradient
Source§impl From<LinearGradient> for Paint
impl From<LinearGradient> for Paint
Source§fn from(g: LinearGradient) -> Paint
fn from(g: LinearGradient) -> Paint
Converts to this type from the input type.
Source§impl PartialEq for LinearGradient
impl PartialEq for LinearGradient
Source§fn eq(&self, other: &LinearGradient) -> bool
fn eq(&self, other: &LinearGradient) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LinearGradient
Auto Trait Implementations§
impl Freeze for LinearGradient
impl RefUnwindSafe for LinearGradient
impl Send for LinearGradient
impl Sync for LinearGradient
impl Unpin for LinearGradient
impl UnsafeUnpin for LinearGradient
impl UnwindSafe for LinearGradient
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more