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)>) -> Self
Sourcepub fn vertical(top: Color, bottom: Color) -> Self
pub fn vertical(top: Color, bottom: Color) -> Self
Top-to-bottom between two colors — the everyday sky/backdrop case.
Sourcepub fn horizontal(leading: Color, trailing: Color) -> Self
pub fn horizontal(leading: Color, trailing: Color) -> Self
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) -> Self
fn from(g: LinearGradient) -> Self
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§
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