pub enum Brush<I = ImageBrush, G = Gradient> {
Solid(AlphaColor<Srgb>),
Gradient(G),
Image(I),
}Expand description
Describes the color content of a filled or stroked shape.
See also BrushRef which can be used to avoid allocations.
Variants§
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, I, G> From<&AlphaColor<CS>> for Brush<I, G>
impl<CS: ColorSpace, I, G> From<&AlphaColor<CS>> for Brush<I, G>
Source§fn from(c: &AlphaColor<CS>) -> Self
fn from(c: &AlphaColor<CS>) -> Self
Converts to this type from the input type.
Source§impl<I, G> From<&DynamicColor> for Brush<I, G>
impl<I, G> From<&DynamicColor> for Brush<I, G>
Source§fn from(c: &DynamicColor) -> Self
fn from(c: &DynamicColor) -> Self
Converts to this type from the input type.
Source§impl<CS: ColorSpace, I, G> From<&OpaqueColor<CS>> for Brush<I, G>
impl<CS: ColorSpace, I, G> From<&OpaqueColor<CS>> for Brush<I, G>
Source§fn from(c: &OpaqueColor<CS>) -> Self
fn from(c: &OpaqueColor<CS>) -> Self
Converts to this type from the input type.
Source§impl<CS: ColorSpace, I, G> From<AlphaColor<CS>> for Brush<I, G>
impl<CS: ColorSpace, I, G> From<AlphaColor<CS>> for Brush<I, G>
Source§fn from(c: AlphaColor<CS>) -> Self
fn from(c: AlphaColor<CS>) -> Self
Converts to this type from the input type.
Source§impl<I, G> From<DynamicColor> for Brush<I, G>
impl<I, G> From<DynamicColor> for Brush<I, G>
Source§fn from(c: DynamicColor) -> Self
fn from(c: DynamicColor) -> Self
Converts to this type from the input type.
Source§impl<G, D> From<ImageBrush<D>> for Brush<ImageBrush<D>, G>
impl<G, D> From<ImageBrush<D>> for Brush<ImageBrush<D>, G>
Source§fn from(value: ImageBrush<D>) -> Self
fn from(value: ImageBrush<D>) -> Self
Converts to this type from the input type.
Source§impl<CS: ColorSpace, I, G> From<OpaqueColor<CS>> for Brush<I, G>
impl<CS: ColorSpace, I, G> From<OpaqueColor<CS>> for Brush<I, G>
Source§fn from(c: OpaqueColor<CS>) -> Self
fn from(c: OpaqueColor<CS>) -> Self
Converts to this type from the input type.
impl<I: Copy, G: Copy> Copy for Brush<I, G>
impl<I, G> StructuralPartialEq for Brush<I, G>
Auto Trait Implementations§
impl<I, G> Freeze for Brush<I, G>
impl<I, G> RefUnwindSafe for Brush<I, G>where
G: RefUnwindSafe,
I: RefUnwindSafe,
impl<I, G> Send for Brush<I, G>
impl<I, G> Sync for Brush<I, G>
impl<I, G> Unpin for Brush<I, G>
impl<I, G> UnwindSafe for Brush<I, G>where
G: UnwindSafe,
I: UnwindSafe,
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