Enum sixtyfps_corelib::graphics::Brush[][src]

#[repr(C)]
#[non_exhaustive]
pub enum Brush {
    SolidColor(Color),
    LinearGradient(LinearGradientBrush),
}

A brush is a data structure that is used to describe how a shape, such as a rectangle, path or even text, shall be filled. A brush can also be applied to the outline of a shape, that means the fill of the outline itself.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
SolidColor(Color)

The color variant of brush is a plain color that is to be used for the fill.

LinearGradient(LinearGradientBrush)

The linear gradient variant of a brush describes the gradient stops for a fill where all color stops are along a line that’s rotated by the specified angle.

Implementations

impl Brush[src]

pub fn color(&self) -> Color[src]

If the brush is SolidColor, the contained color is returned. If the brush is a LinearGradient, the color of the first stop is returned.

pub fn is_transparent(&self) -> bool[src]

Returns true if this brush contains a fully transparent color (alpha value is zero)

assert!(Brush::default().is_transparent());
assert!(Brush::SolidColor(Color::from_argb_u8(0, 255, 128, 140)).is_transparent());
assert!(!Brush::SolidColor(Color::from_argb_u8(25, 128, 140, 210)).is_transparent());

Trait Implementations

impl Clone for Brush[src]

impl Debug for Brush[src]

impl Default for Brush[src]

Construct a brush with transparent color

impl From<Color> for Brush[src]

impl From<LinearGradientBrush> for Brush[src]

impl InterpolatedPropertyValue for Brush[src]

impl PartialEq<Brush> for Brush[src]

impl StructuralPartialEq for Brush[src]

Auto Trait Implementations

impl RefUnwindSafe for Brush

impl !Send for Brush

impl !Sync for Brush

impl Unpin for Brush

impl UnwindSafe for Brush

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.