pub struct ColorStop {
pub offset: f32,
pub color: DynamicColor,
}
Expand description
Offset and color of a transition point in a gradient.
Color stops are compatible with use as a cache key.
Fields§
§offset: f32
Normalized offset of the stop.
color: DynamicColor
Color at the specified offset.
Implementations§
Source§impl ColorStop
impl ColorStop
Sourcepub const fn with_alpha(self, alpha: f32) -> Self
pub const fn with_alpha(self, alpha: f32) -> Self
Returns the color stop with the alpha component set to alpha
.
Sourcepub const fn multiply_alpha(self, alpha: f32) -> Self
pub const fn multiply_alpha(self, alpha: f32) -> Self
Returns the color stop with the alpha component multiplied by alpha
.
The behaviour of this transformation is undefined if alpha
is negative.
If any resulting alphas would overflow, these currently saturate (to opaque).
Trait Implementations§
Source§impl<CS: ColorSpace> From<(f32, AlphaColor<CS>)> for ColorStop
impl<CS: ColorSpace> From<(f32, AlphaColor<CS>)> for ColorStop
Source§fn from(pair: (f32, AlphaColor<CS>)) -> Self
fn from(pair: (f32, AlphaColor<CS>)) -> Self
Converts to this type from the input type.
Source§impl From<(f32, DynamicColor)> for ColorStop
impl From<(f32, DynamicColor)> for ColorStop
Source§fn from(pair: (f32, DynamicColor)) -> Self
fn from(pair: (f32, DynamicColor)) -> Self
Converts to this type from the input type.
Source§impl<CS: ColorSpace> From<(f32, OpaqueColor<CS>)> for ColorStop
impl<CS: ColorSpace> From<(f32, OpaqueColor<CS>)> for ColorStop
Source§fn from(pair: (f32, OpaqueColor<CS>)) -> Self
fn from(pair: (f32, OpaqueColor<CS>)) -> Self
Converts to this type from the input type.
impl Copy for ColorStop
impl StructuralPartialEq for ColorStop
Auto Trait Implementations§
impl Freeze for ColorStop
impl RefUnwindSafe for ColorStop
impl Send for ColorStop
impl Sync for ColorStop
impl Unpin for ColorStop
impl UnwindSafe for ColorStop
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