pub enum Brush {
Solid(AlphaColor<Srgb>),
Gradient(Gradient),
Image(Image),
}
Expand description
Describes the color content of a filled or stroked shape.
See also BrushRef
which can be used to avoid allocations.
Variants§
Solid(AlphaColor<Srgb>)
Solid color brush.
Gradient(Gradient)
Gradient brush.
Image(Image)
Image brush.
Implementations§
Source§impl Brush
impl Brush
Sourcepub fn with_alpha(self, alpha: f32) -> Self
pub fn with_alpha(self, alpha: f32) -> Self
Returns the brush with the alpha component set to alpha
.
Sourcepub fn multiply_alpha(self, alpha: f32) -> Self
pub fn multiply_alpha(self, alpha: f32) -> Self
Returns the brush 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<AlphaColor<CS>> for Brush
impl<CS: ColorSpace> From<AlphaColor<CS>> for Brush
Source§fn from(c: AlphaColor<CS>) -> Self
fn from(c: AlphaColor<CS>) -> Self
Converts to this type from the input type.
Source§impl From<DynamicColor> for Brush
impl From<DynamicColor> for Brush
Source§fn from(c: DynamicColor) -> Self
fn from(c: DynamicColor) -> Self
Converts to this type from the input type.
Source§impl<CS: ColorSpace> From<OpaqueColor<CS>> for Brush
impl<CS: ColorSpace> From<OpaqueColor<CS>> for Brush
Source§fn from(c: OpaqueColor<CS>) -> Self
fn from(c: OpaqueColor<CS>) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Brush
Auto Trait Implementations§
impl Freeze for Brush
impl !RefUnwindSafe for Brush
impl Send for Brush
impl Sync for Brush
impl Unpin for Brush
impl !UnwindSafe for Brush
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