pub struct Rgba { /* private fields */ }
Expand description
A color defined by red, green, blue, and alpha components.
Implementations§
source§impl Rgba
impl Rgba
sourcepub fn new(
r: Rational,
g: Rational,
b: Rational,
a: Rational,
s: RgbFormat
) -> Self
pub fn new( r: Rational, g: Rational, b: Rational, a: Rational, s: RgbFormat ) -> Self
Create a new rgba color.
sourcepub fn name(&self) -> Option<&'static str>
pub fn name(&self) -> Option<&'static str>
If this color is equal to a named color, get the name.
Each component is rounded to its byte value before lookup.
sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
If name
is a known color name, get the corresponding rgba value.
sourcepub fn alpha(&self) -> Rational
pub fn alpha(&self) -> Rational
Get the alpha value of this color.
Zero is fully transparent, one is fully opaque.
Trait Implementations§
source§impl Ord for Rgba
impl Ord for Rgba
source§impl PartialEq for Rgba
impl PartialEq for Rgba
source§impl PartialOrd for Rgba
impl PartialOrd for Rgba
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq 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 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