Skip to main content

Rgba

Type Alias Rgba 

Source
pub type Rgba<S = Srgb, T = f32> = Alpha<Rgb<S, T>, T>;
Expand description

Generic RGB with an alpha component. See the Rgba implementation in Alpha.

Aliased Type§

#[repr(C)]
pub struct Rgba<S = Srgb, T = f32> { pub color: Rgb<S, T>, pub alpha: T, }

Fields§

§color: Rgb<S, T>

The color.

§alpha: T

The transparency component. 0.0 (or 0u8) is fully transparent and 1.0 (or 255u8) is fully opaque.

Trait Implementations§

Source§

impl ColorExt for Rgba

Source§

fn blend(&self, other: &Self) -> Self

Performs a SrcAlpha x (1 - SrcAlpha) blend
Source§

fn fade_out(&mut self, factor: f32)

Fade out the color by a given factor. This factor should be between 0.0 and 1.0. Where 0.0 will leave the color unchanged, and 1.0 will completely fade out the color.
Source§

fn opacity(&self, factor: f32) -> Self

Multiplies the alpha value of the color by a given factor and returns a new color. If the color was previously opaque, then this is equivalent to with_alpha. Read more
Source§

impl Lerp for Rgba

Source§

fn lerp(&self, to: &Self, delta: f32) -> Self

Interpolates between self and to based on delta.