pub struct Gradient {
pub kind: GradientKind,
pub extend: Extend,
pub stops: SmallVec<[ColorStop; 4]>,
}
Expand description
Definition of a gradient that transitions between two or more colors.
Fields§
§kind: GradientKind
Kind and properties of the gradient.
extend: Extend
Extend mode.
stops: SmallVec<[ColorStop; 4]>
Color stop collection.
Implementations§
source§impl Gradient
impl Gradient
sourcepub fn new_linear(start: impl Into<Point>, end: impl Into<Point>) -> Gradient
pub fn new_linear(start: impl Into<Point>, end: impl Into<Point>) -> Gradient
Creates a new linear gradient for the specified start and end points.
sourcepub fn new_radial(center: impl Into<Point>, radius: f32) -> Gradient
pub fn new_radial(center: impl Into<Point>, radius: f32) -> Gradient
Creates a new radial gradient for the specified center point and radius.
sourcepub fn new_two_point_radial(
start_center: impl Into<Point>,
start_radius: f32,
end_center: impl Into<Point>,
end_radius: f32
) -> Gradient
pub fn new_two_point_radial( start_center: impl Into<Point>, start_radius: f32, end_center: impl Into<Point>, end_radius: f32 ) -> Gradient
Creates a new two point radial gradient for the specified center points and radii.
sourcepub fn new_sweep(
center: impl Into<Point>,
start_angle: f32,
end_angle: f32
) -> Gradient
pub fn new_sweep( center: impl Into<Point>, start_angle: f32, end_angle: f32 ) -> Gradient
Creates a new sweep gradient for the specified center point, start and end angles.
sourcepub fn with_extend(self, mode: Extend) -> Gradient
pub fn with_extend(self, mode: Extend) -> Gradient
Builder method for setting the gradient extend mode.
sourcepub fn with_stops(self, stops: impl ColorStopsSource) -> Gradient
pub fn with_stops(self, stops: impl ColorStopsSource) -> Gradient
Builder method for setting the color stop collection.
Trait Implementations§
source§impl From<Gradient> for BackgroundBrush
impl From<Gradient> for BackgroundBrush
source§fn from(src: Gradient) -> BackgroundBrush
fn from(src: Gradient) -> BackgroundBrush
Converts to this type from the input type.
source§impl PartialEq for Gradient
impl PartialEq for Gradient
impl StructuralPartialEq for Gradient
Auto Trait Implementations§
impl Freeze for Gradient
impl RefUnwindSafe for Gradient
impl Send for Gradient
impl Sync for Gradient
impl Unpin for Gradient
impl UnwindSafe for Gradient
Blanket Implementations§
source§impl<T> AsAny for Twhere
T: Any,
impl<T> AsAny for Twhere
T: Any,
source§fn as_dyn_any(&self) -> &(dyn Any + 'static)
fn as_dyn_any(&self) -> &(dyn Any + 'static)
Return self.
source§fn as_mut_dyn_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_dyn_any(&mut self) -> &mut (dyn Any + 'static)
Return self.
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