pub struct Rgba {
pub r: f64,
pub g: f64,
pub b: f64,
pub a: f64,
}Expand description
RGBA color with f64 components in range [0, 1].
Port of C++ rgba.
Fields§
§r: f64§g: f64§b: f64§a: f64Implementations§
Source§impl Rgba
impl Rgba
pub fn new(r: f64, g: f64, b: f64, a: f64) -> Self
pub fn new_rgb(r: f64, g: f64, b: f64) -> Self
pub fn with_opacity(c: &Rgba, a: f64) -> Self
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: f64) -> &mut Self
pub fn demultiply(&mut self) -> &mut Self
Sourcepub fn gradient(&self, c: &Rgba, k: f64) -> Rgba
pub fn gradient(&self, c: &Rgba, k: f64) -> Rgba
Interpolate between self and c by parameter k.
pub fn no_color() -> Self
Sourcepub fn from_wavelength(wl: f64, gamma: f64) -> Self
pub fn from_wavelength(wl: f64, gamma: f64) -> Self
Create a color from a visible light wavelength (380–780 nm).
Trait Implementations§
Source§impl AddAssign for Rgba
impl AddAssign for Rgba
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl MulAssign<f64> for Rgba
impl MulAssign<f64> for Rgba
Source§fn mul_assign(&mut self, k: f64)
fn mul_assign(&mut self, k: f64)
Performs the
*= operation. Read moreimpl Copy for Rgba
impl StructuralPartialEq for Rgba
Auto Trait Implementations§
impl Freeze for Rgba
impl RefUnwindSafe for Rgba
impl Send for Rgba
impl Sync for Rgba
impl Unpin for Rgba
impl UnsafeUnpin for Rgba
impl UnwindSafe for Rgba
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