BrushRef

Type Alias BrushRef 

Source
pub type BrushRef<'a> = Brush<ImageBrushRef<'a>, &'a Gradient>;
Expand description

Reference to a brush.

This is useful for methods that would like to accept brushes by reference. Defining the type as impl Into<BrushRef> allows accepting types like &Gradient directly without cloning or allocating.

Aliased Type§

pub enum BrushRef<'a> {
    Solid(AlphaColor<Srgb>),
    Gradient(&'a Gradient),
    Image(ImageBrush<&'a ImageData>),
}

Variants§

§

Solid(AlphaColor<Srgb>)

Solid color brush.

§

Gradient(&'a Gradient)

Gradient brush.

§

Image(ImageBrush<&'a ImageData>)

Image brush.

Implementations§

Source§

impl BrushRef<'_>

Source

pub fn to_owned(&self) -> Brush

Converts the reference to an owned brush.

Trait Implementations§

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<'a> From<&'a Gradient> for BrushRef<'a>

Source§

fn from(gradient: &'a Gradient) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(image: &'a ImageBrush) -> Self

Converts to this type from the input type.