pub struct LinearGradient {
pub start: (f32, f32),
pub end: (f32, f32),
pub stops: Vec<GradientStop>,
}Expand description
A linear gradient defined by an axis (start → end) and colour stops.
Fields§
§start: (f32, f32)Axis start point (logical pixels).
end: (f32, f32)Axis end point (logical pixels).
stops: Vec<GradientStop>Colour stops, sorted by ascending offset.
Implementations§
Source§impl LinearGradient
impl LinearGradient
Sourcepub fn two_stop(
start: (f32, f32),
end: (f32, f32),
from: Color,
to: Color,
) -> Self
pub fn two_stop( start: (f32, f32), end: (f32, f32), from: Color, to: Color, ) -> Self
Construct a two-stop gradient from from at start to to at end.
Sourcepub fn new(start: (f32, f32), end: (f32, f32), stops: Vec<GradientStop>) -> Self
pub fn new(start: (f32, f32), end: (f32, f32), stops: Vec<GradientStop>) -> Self
Construct from arbitrary stops; they are sorted by offset internally.
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 moreAuto 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
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