Struct Gradient
pub struct Gradient {
pub kind: GradientKind,
pub extend: Extend,
pub interpolation_cs: ColorSpaceTag,
pub hue_direction: HueDirection,
pub interpolation_alpha_space: InterpolationAlphaSpace,
pub stops: ColorStops,
}Expand description
Definition of a gradient that transitions between two or more colors.
Fields§
§kind: GradientKindKind and properties of the gradient.
extend: ExtendExtend mode.
interpolation_cs: ColorSpaceTagThe color space to be used for interpolation.
The gradient’s color ramps will be interpolated linearly in this color space between the specified color stops.
This defaults to sRGB.
hue_direction: HueDirectionWhen interpolating within a cylindrical color space, the direction for the hue.
This is interpreted as described in CSS Color Module Level 4 § 12.4.
interpolation_alpha_space: InterpolationAlphaSpaceAlpha space to be used for interpolation
stops: ColorStopsColor stop collection.
Implementations§
§impl Gradient
impl Gradient
pub 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.
pub 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.
pub 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.
pub 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.
pub const fn with_extend(self, mode: Extend) -> Gradient
pub const fn with_extend(self, mode: Extend) -> Gradient
Builder method for setting the gradient extend mode.
pub const fn with_interpolation_cs(
self,
interpolation_cs: ColorSpaceTag,
) -> Gradient
pub const fn with_interpolation_cs( self, interpolation_cs: ColorSpaceTag, ) -> Gradient
Builder method for setting the interpolation color space.
pub const fn with_interpolation_alpha_space(
self,
interpolation_alpha_space: InterpolationAlphaSpace,
) -> Gradient
pub const fn with_interpolation_alpha_space( self, interpolation_alpha_space: InterpolationAlphaSpace, ) -> Gradient
Builder method for setting the interpolation alpha space.
pub const fn with_hue_direction(self, hue_direction: HueDirection) -> Gradient
pub const fn with_hue_direction(self, hue_direction: HueDirection) -> Gradient
Builder method for setting the hue direction when interpolating within a cylindrical color space.
pub 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.
pub fn with_alpha(self, alpha: f32) -> Gradient
pub fn with_alpha(self, alpha: f32) -> Gradient
Returns the gradient with the alpha component for all color stops set to alpha.
pub fn multiply_alpha(self, alpha: f32) -> Gradient
pub fn multiply_alpha(self, alpha: f32) -> Gradient
Returns the gradient with the alpha component for all color stops
multiplied by alpha.
Trait Implementations§
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 UnsafeUnpin for Gradient
impl UnwindSafe for Gradient
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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