pub struct Linear {
pub angle: Radians,
pub stops: [Option<ColorStop>; 8],
}
Expand description
A linear gradient.
Fields§
§angle: Radians
How the Gradient
is angled within its bounds.
stops: [Option<ColorStop>; 8]
ColorStop
s along the linear gradient path.
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.
Sourcepub fn scale_alpha(self, factor: f32) -> Self
pub fn scale_alpha(self, factor: f32) -> Self
Scales the alpha channel of the Linear
gradient by the given
factor.
Trait Implementations§
Source§impl From<Linear> for Background
impl From<Linear> for Background
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