#[repr(C)]pub struct Rgba<T> {
pub r: T,
pub g: T,
pub b: T,
pub a: T,
}Expand description
Represents any RGBA values, Rgba
Fields§
§r: TRed component
g: TGreen component
b: TBlue component
a: TAlpha component
Implementations§
source§impl Rgba<f32>
impl Rgba<f32>
sourcepub fn blend_over_alpha(&self, color_foreground: Rgba<f32>) -> Rgba<f32>
pub fn blend_over_alpha(&self, color_foreground: Rgba<f32>) -> Rgba<f32>
Using alpha blend over algorithm where current color is on bottom ( destination )
sourcepub fn blend_over_with_op(
&self,
color_foreground: Rgba<f32>,
op: fn(_: f32, _: f32) -> f32,
) -> Rgba<f32>
pub fn blend_over_with_op( &self, color_foreground: Rgba<f32>, op: fn(_: f32, _: f32) -> f32, ) -> Rgba<f32>
Using alpha blend over algorithm where current color is on bottom ( destination ) aR = aA + aB·(1−aA) xR = 1/aR · [ (1−aB)·xaA + (1−aA)·xaB + aA·aB·f(xA,xB) ]
pub fn blend_overlay(&self, other: Rgba<f32>) -> Rgba<f32>
sourcepub fn blend_add(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_add(&self, other: Rgba<f32>) -> Rgba<f32>
The output of the ADD operator is the same for both bounded and unbounded source interpretations. Resulting alpha (aR) - min(1, aA+aB) Resulting color (xR) - (xaA + xaB)/aR
sourcepub fn blend_saturate(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_saturate(&self, other: Rgba<f32>) -> Rgba<f32>
The output of the ADD operator is the same for both bounded and unbounded source interpretations. Resulting alpha (aR) - min(1, aA+aB) Resulting color (xR) - (min(aA, 1−aB)·xA + xaB)/aR
pub fn blend_substract(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_lighten(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_darken(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_color_burn(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_color_dodge(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_screen(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_linear_light(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_vivid_light(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_pin_light(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_hard_mix(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_reflect(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_difference(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_hard_light(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_soft_light(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_exclusion(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_in(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_out(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_atop(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_dest_out(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_dest_atop(&self, other: Rgba<f32>) -> Rgba<f32>
sourcepub fn blend_xor(&self, other: Rgba<f32>) -> Rgba<f32>
pub fn blend_xor(&self, other: Rgba<f32>) -> Rgba<f32>
The output of the ADD operator is the same for both bounded and unbounded source interpretations. Resulting alpha (aR) - aA + aB − 2·aA·aB Resulting color (xR) - (xaA·(1−aB) + xaB·(1−aA))/aR
pub fn clip_color(&self) -> Rgba<f32>
pub fn blend_hsl_color(&self, backdrop: Rgba<f32>) -> Rgba<f32>
pub fn blend_hsl_saturation(&self, backdrop: Rgba<f32>) -> Rgba<f32>
pub fn contrast(&self, contrast: f32) -> Rgba<f32>
pub fn saturation(&self, saturation: f32) -> Rgba<f32>
pub fn grayscale(&self, grayscale_amount: f32) -> Rgba<f32>
source§impl Rgba<u8>
impl Rgba<u8>
pub fn from_rgb(r: u8, g: u8, b: u8) -> Rgba<u8>
pub fn to_rgb(&self) -> Rgb<u8>
sourcepub fn blend_over_alpha(&self, color_foreground: Rgba<u8>) -> Rgba<u8>
pub fn blend_over_alpha(&self, color_foreground: Rgba<u8>) -> Rgba<u8>
Using alpha blend over algorithm where current color is on bottom ( destination )
sourcepub fn blend_hsl_lumonosity(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_hsl_lumonosity(&self, backdrop: Rgba<u8>) -> Rgba<u8>
f(cA,cB) = set_lum(cB, lum(cA))
pub fn blend_overlay(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_add(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_substract(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_lighten(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_darken(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_color_burn(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_color_dodge(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_screen(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_linear_light(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_vivid_light(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_pin_light(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_hard_mix(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_reflect(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_difference(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_saturate(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_hard_light(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_soft_light(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_exclusion(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_in(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_out(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_atop(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_dest_out(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_dest_atop(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn blend_xor(&self, backdrop: Rgba<u8>) -> Rgba<u8>
pub fn contrast(&self, contrast: f32) -> Rgba<u8>
pub fn saturation(&self, saturation: f32) -> Rgba<u8>
pub fn grayscale(&self, grayscale_amount: f32) -> Rgba<u8>
sourcepub fn to_linear(&self, transfer_function: TransferFunction) -> Rgba<f32>
pub fn to_linear(&self, transfer_function: TransferFunction) -> Rgba<f32>
Converts gamma corrected RGBA to linear RGBA
§Arguments
transfer_function - Transfer function to convert RGB into linear RGB
sourcepub fn from_linear(
linear_rgb: Rgba<f32>,
transfer_function: TransferFunction,
) -> Rgba<u8>
pub fn from_linear( linear_rgb: Rgba<f32>, transfer_function: TransferFunction, ) -> Rgba<u8>
Converts gamma corrected RGB to linear RGB
§Arguments
transfer_function - Transfer function to convert RGB into linear RGB
Trait Implementations§
source§impl<T> AddAssign for Rgba<T>where
T: AddAssign<T>,
impl<T> AddAssign for Rgba<T>where
T: AddAssign<T>,
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moresource§impl<T> DivAssign<f32> for Rgba<T>
impl<T> DivAssign<f32> for Rgba<T>
source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/= operation. Read moresource§impl<T> DivAssign<f64> for Rgba<T>
impl<T> DivAssign<f64> for Rgba<T>
source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
/= operation. Read moresource§impl<T> DivAssign<i16> for Rgba<T>
impl<T> DivAssign<i16> for Rgba<T>
source§fn div_assign(&mut self, rhs: i16)
fn div_assign(&mut self, rhs: i16)
/= operation. Read moresource§impl<T> DivAssign<i32> for Rgba<T>
impl<T> DivAssign<i32> for Rgba<T>
source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
/= operation. Read moresource§impl<T> DivAssign<u16> for Rgba<T>
impl<T> DivAssign<u16> for Rgba<T>
source§fn div_assign(&mut self, rhs: u16)
fn div_assign(&mut self, rhs: u16)
/= operation. Read moresource§impl<T> DivAssign<u32> for Rgba<T>
impl<T> DivAssign<u32> for Rgba<T>
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/= operation. Read moresource§impl<T> DivAssign<u8> for Rgba<T>
impl<T> DivAssign<u8> for Rgba<T>
source§fn div_assign(&mut self, rhs: u8)
fn div_assign(&mut self, rhs: u8)
/= operation. Read moresource§impl<T> DivAssign for Rgba<T>where
T: DivAssign<T>,
impl<T> DivAssign for Rgba<T>where
T: DivAssign<T>,
source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moresource§impl<T> EuclideanDistance for Rgba<T>where
T: AsPrimitive<f32>,
impl<T> EuclideanDistance for Rgba<T>where
T: AsPrimitive<f32>,
fn euclidean_distance(&self, other: Self) -> f32
source§impl<T: PartialOrd> PartialOrd for Rgba<T>
impl<T: PartialOrd> PartialOrd for Rgba<T>
source§impl<T> TaxicabDistance for Rgba<T>where
T: AsPrimitive<f32>,
impl<T> TaxicabDistance for Rgba<T>where
T: AsPrimitive<f32>,
fn taxicab_distance(&self, other: Self) -> f32
source§impl ToRgba1010102 for Rgba<f16>
impl ToRgba1010102 for Rgba<f16>
fn to_rgba1010102(&self) -> Rgba1010102
source§impl ToRgba1010102 for Rgba<u8>
impl ToRgba1010102 for Rgba<u8>
fn to_rgba1010102(&self) -> Rgba1010102
impl<T: Copy> Copy for Rgba<T>
impl<T> StructuralPartialEq for Rgba<T>
Auto Trait Implementations§
impl<T> Freeze for Rgba<T>where
T: Freeze,
impl<T> RefUnwindSafe for Rgba<T>where
T: RefUnwindSafe,
impl<T> Send for Rgba<T>where
T: Send,
impl<T> Sync for Rgba<T>where
T: Sync,
impl<T> Unpin for Rgba<T>where
T: Unpin,
impl<T> UnwindSafe for Rgba<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more