pub struct Rgba { /* private fields */ }
Expand description
Rgba represents the colors red, green, blue, alpha. Alpha represents the transparency of the image while red, green and blue represent the intensity of the colors.
Alpha is managed between 0 - 100 Red Green and Blue is managed between 0 - 255
Implementations§
Source§impl Rgba
impl Rgba
Sourcepub fn rgb(red: u8, green: u8, blue: u8) -> Rgba
pub fn rgb(red: u8, green: u8, blue: u8) -> Rgba
Create a color by specifying red, green and blue
Sourcepub fn bgr(blue: u8, green: u8, red: u8) -> Rgba
pub fn bgr(blue: u8, green: u8, red: u8) -> Rgba
Create a color by specifying blue, green and red
Sourcepub fn bgra(blue: u8, green: u8, red: u8, alpha: u8) -> Rgba
pub fn bgra(blue: u8, green: u8, red: u8, alpha: u8) -> Rgba
Create a color by specifying blue, green, red and alpha
Sourcepub fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> Rgba
pub fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> Rgba
Create a color by specifying red, green, blue and alpha
Sourcepub fn recolor_to(&mut self, other: &Self)
pub fn recolor_to(&mut self, other: &Self)
Change the current color to the other color
Sourcepub fn is_transparent(&self) -> bool
pub fn is_transparent(&self) -> bool
Check if the alpha value is less then 100 (Visible)
Source§impl Rgba
Methods used to manipulate the rgba color in a certain way
impl Rgba
Methods used to manipulate the rgba color in a certain way
Sourcepub fn color_to_gray(&mut self)
pub fn color_to_gray(&mut self)
Convert pixel color to gray scale
Sourcepub fn linear_interpolation(
lhs: &Rgba,
lhs_factor: f32,
rhs: &Rgba,
rhs_factor: f32,
) -> Result<Rgba, &'static str>
pub fn linear_interpolation( lhs: &Rgba, lhs_factor: f32, rhs: &Rgba, rhs_factor: f32, ) -> Result<Rgba, &'static str>
Blur 2 color’s together
By passing in different factors, you can effect how much one color will effect the other.
@param {&Rgba} first color to linear_interpolation @param {f32} factor how much the first color will effect the outcome @param {&Rgba} second color to linear_interpolation @param {f32} factor how much the second color will effect the outcome @return {Rgba} new color of the 2 colors blurred together