pub struct Rgba8 {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
RGBA color with u8 components.
Port of C++ rgba8T<linear> (linear colorspace variant).
Fields§
§r: u8§g: u8§b: u8§a: u8Implementations§
Source§impl Rgba8
impl Rgba8
pub const BASE_SHIFT: u32 = 8
pub const BASE_SCALE: u32
pub const BASE_MASK: u32
pub const BASE_MSB: u32
pub fn new(r: u32, g: u32, b: u32, a: u32) -> Self
pub fn new_opaque(r: u32, g: u32, b: u32) -> Self
pub fn with_opacity(c: &Rgba8, a: u32) -> Self
pub fn to_double(a: u8) -> f64
pub fn from_double(a: f64) -> u8
pub fn empty_value() -> u8
pub fn full_value() -> u8
pub fn is_transparent(&self) -> bool
pub fn is_opaque(&self) -> bool
pub fn invert(x: u8) -> u8
Sourcepub fn multiply(a: u8, b: u8) -> u8
pub fn multiply(a: u8, b: u8) -> u8
Fixed-point multiply, exact over u8.
(a * b + 128) >> 8, with rounding correction.
Sourcepub fn demultiply_value(a: u8, b: u8) -> u8
pub fn demultiply_value(a: u8, b: u8) -> u8
Fixed-point demultiply.
Sourcepub fn mult_cover(a: u8, b: CoverType) -> u8
pub fn mult_cover(a: u8, b: CoverType) -> u8
Multiply a color component by a cover.
Sourcepub fn scale_cover(a: CoverType, b: u8) -> CoverType
pub fn scale_cover(a: CoverType, b: u8) -> CoverType
Scale a cover by a value.
Sourcepub fn prelerp(p: u8, q: u8, a: u8) -> u8
pub fn prelerp(p: u8, q: u8, a: u8) -> u8
Interpolate p to q by a, assuming q is premultiplied by a.
pub fn clear(&mut self) -> &mut Self
pub fn transparent(&mut self) -> &mut Self
pub fn set_opacity(&mut self, a: f64) -> &mut Self
pub fn opacity(&self) -> f64
pub fn premultiply(&mut self) -> &mut Self
pub fn premultiply_with_alpha(&mut self, a_: u32) -> &mut Self
pub fn demultiply(&mut self) -> &mut Self
Sourcepub fn gradient(&self, c: &Rgba8, k: f64) -> Rgba8
pub fn gradient(&self, c: &Rgba8, k: f64) -> Rgba8
Interpolate between self and c by parameter k (0.0 to 1.0).
Sourcepub fn apply_gamma_dir(&mut self, gamma: &GammaLut)
pub fn apply_gamma_dir(&mut self, gamma: &GammaLut)
Apply forward gamma correction.
Sourcepub fn apply_gamma_inv(&mut self, gamma: &GammaLut)
pub fn apply_gamma_inv(&mut self, gamma: &GammaLut)
Apply inverse gamma correction.
pub fn no_color() -> Self
pub fn from_wavelength(wl: f64, gamma: f64) -> Self
Trait Implementations§
impl Copy for Rgba8
impl Eq for Rgba8
impl StructuralPartialEq for Rgba8
Auto Trait Implementations§
impl Freeze for Rgba8
impl RefUnwindSafe for Rgba8
impl Send for Rgba8
impl Sync for Rgba8
impl Unpin for Rgba8
impl UnwindSafe for Rgba8
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
Mutably borrows from an owned value. Read more