pub struct Linear {
pub start: Point,
pub end: Point,
pub stops: [Option<ColorStop>; 8],
}Expand description
A linear gradient.
Fields§
§start: PointThe absolute starting position of the gradient.
end: PointThe absolute ending position of the gradient.
stops: [Option<ColorStop>; 8][ColorStop]s along the linear gradient direction.
Implementations§
Source§impl Linear
impl Linear
Sourcepub fn add_stop(self, offset: f32, color: Color) -> Self
pub fn add_stop(self, offset: f32, color: Color) -> Self
Adds a new [ColorStop], defined by an offset and a color, to the gradient.
Any offset that is not within 0.0..=1.0 will be silently ignored.
Any stop added after the 8th will be silently ignored.
Sourcepub fn add_stops(self, stops: impl IntoIterator<Item = ColorStop>) -> Self
pub fn add_stops(self, stops: impl IntoIterator<Item = ColorStop>) -> Self
Adds multiple [ColorStop]s to the gradient.
Any stop added after the 8th will be silently ignored.
Trait Implementations§
impl Copy for Linear
impl StructuralPartialEq for Linear
Auto Trait Implementations§
impl Freeze for Linear
impl RefUnwindSafe for Linear
impl Send for Linear
impl Sync for Linear
impl Unpin for Linear
impl UnwindSafe for Linear
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