pub struct LinearGradient {
pub angle: Angle,
pub stops: [Option<ColorStop>; 8],
}
Expand description
A linear gradient.
Fields§
§angle: Angle
How the Gradient
is angled within its bounds.
stops: [Option<ColorStop>; 8]
ColorStop
s along the linear gradient path.
Implementations§
Source§impl LinearGradient
impl LinearGradient
Sourcepub const fn new(angle: Angle) -> Self
pub const fn new(angle: Angle) -> Self
Creates a new [Linear
] gradient with the given angle in Angle
.
Sourcepub fn add_stop(self, offset: f32, color: impl Into<PackedSrgb>) -> Self
pub fn add_stop(self, offset: f32, color: impl Into<PackedSrgb>) -> 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§
Source§impl Clone for LinearGradient
impl Clone for LinearGradient
Source§fn clone(&self) -> LinearGradient
fn clone(&self) -> LinearGradient
Returns a copy of the value. Read more
1.0.0 · 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 Gradient
impl From<LinearGradient> for Gradient
Source§fn from(gradient: LinearGradient) -> Self
fn from(gradient: LinearGradient) -> Self
Converts to this type from the input type.
Source§impl PartialEq for LinearGradient
impl PartialEq for LinearGradient
impl Copy for LinearGradient
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 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