Brush

Enum Brush 

Source
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§

§

Solid(AlphaColor<Srgb>)

Solid color brush.

§

Gradient(G)

Gradient brush.

§

Image(I)

Image brush.

Implementations§

Source§

impl Brush

Source

pub fn with_alpha(self, alpha: f32) -> Self

Returns the brush with the alpha component set to alpha.

Source

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).

Source§

impl Brush<ImageBrush<&ImageData>, &Gradient>

Source

pub fn to_owned(&self) -> Brush

Converts the reference to an owned brush.

Trait Implementations§

Source§

impl<I: Clone, G: Clone> Clone for Brush<I, G>

Source§

fn clone(&self) -> Brush<I, G>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I: Debug, G: Debug> Debug for Brush<I, G>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I, G> Default for Brush<I, G>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<CS: ColorSpace, I, G> From<&AlphaColor<CS>> for Brush<I, G>

Source§

fn from(c: &AlphaColor<CS>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Brush> for BrushRef<'a>

Source§

fn from(brush: &'a Brush) -> Self

Converts to this type from the input type.
Source§

impl<I, G> From<&DynamicColor> for Brush<I, G>

Source§

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>

Source§

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>

Source§

fn from(c: AlphaColor<CS>) -> Self

Converts to this type from the input type.
Source§

impl<I, G> From<DynamicColor> for Brush<I, G>

Source§

fn from(c: DynamicColor) -> Self

Converts to this type from the input type.
Source§

impl<I> From<Gradient> for Brush<I, Gradient>

Source§

fn from(g: Gradient) -> Self

Converts to this type from the input type.
Source§

impl<G, D> From<ImageBrush<D>> for Brush<ImageBrush<D>, G>

Source§

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>

Source§

fn from(c: OpaqueColor<CS>) -> Self

Converts to this type from the input type.
Source§

impl<I: PartialEq, G: PartialEq> PartialEq for Brush<I, G>

Source§

fn eq(&self, other: &Brush<I, G>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I: Copy, G: Copy> Copy for Brush<I, G>

Source§

impl<I, G> StructuralPartialEq for Brush<I, G>

Auto Trait Implementations§

§

impl<I, G> Freeze for Brush<I, G>
where G: Freeze, I: Freeze,

§

impl<I, G> RefUnwindSafe for Brush<I, G>

§

impl<I, G> Send for Brush<I, G>
where G: Send, I: Send,

§

impl<I, G> Sync for Brush<I, G>
where G: Sync, I: Sync,

§

impl<I, G> Unpin for Brush<I, G>
where G: Unpin, I: Unpin,

§

impl<I, G> UnwindSafe for Brush<I, G>
where G: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.