[−][src]Struct rustbitmap::bitmap::rgba::Rgba
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
Methods
impl Rgba
[src]
pub fn white() -> Rgba
[src]
Create the color white
pub fn black() -> Rgba
[src]
Create the color black
pub fn rgb(red: u8, green: u8, blue: u8) -> Rgba
[src]
Create a color by specifying red, green and blue
pub fn bgr(blue: u8, green: u8, red: u8) -> Rgba
[src]
Create a color by specifying blue, green and red
pub fn bgra(blue: u8, green: u8, red: u8, alpha: u8) -> Rgba
[src]
Create a color by specifying blue, green, red and alpha
pub fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> Rgba
[src]
Create a color by specifying red, green, blue and alpha
pub fn recolor_to(&mut self, other: &Self)
[src]
Change the current color to the other color
pub fn is_transparent(&self) -> bool
[src]
Check if the alpha value is less then 100 (Visible)
pub fn get_red(&self) -> u8
[src]
get the amount of red in the pixel
pub fn get_green(&self) -> u8
[src]
get the amount of green in the pixel
pub fn get_blue(&self) -> u8
[src]
get the amount of blue in the pixel
pub fn get_alpha(&self) -> u8
[src]
get the amount of alpha in the pixel
impl Rgba
[src]
Methods used to manipulate the rgba color in a certain way
pub fn color_to_gray(&mut self)
[src]
Convert pixel color to gray scale
pub fn linear_interpolation(
lhs: &Rgba,
lhs_factor: f32,
rhs: &Rgba,
rhs_factor: f32
) -> Result<Rgba, &'static str>
[src]
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
pub fn cubic_interpolate(
p0: &Rgba,
p1: &Rgba,
p2: &Rgba,
p3: &Rgba,
factor: f32
) -> Rgba
[src]
p0: &Rgba,
p1: &Rgba,
p2: &Rgba,
p3: &Rgba,
factor: f32
) -> Rgba
Use cubic interpolation on 4 colors between range [0, 1] then find x as a factor that is between [0, 1] (ex. 0.5)
Reference: https://www.paulinternet.nl/?page=bicubic
Trait Implementations
impl Clone for Rgba
[src]
fn clone(&self) -> Rgba
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Rgba
[src]
impl PartialEq<Rgba> for Rgba
[src]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Display for Rgba
[src]
impl Debug for Rgba
[src]
Auto Trait Implementations
impl Send for Rgba
impl Unpin for Rgba
impl Sync for Rgba
impl UnwindSafe for Rgba
impl RefUnwindSafe for Rgba
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,