Struct femtovg::Color [−][src]
Expand description
Struct for representing colors.
Fields
r: f32
g: f32
b: f32
a: f32
Implementations
impl Color
[src]
impl Color
[src]pub fn rgb(r: u8, g: u8, b: u8) -> Self
[src]
pub fn rgb(r: u8, g: u8, b: u8) -> Self
[src]Returns a color value from red, green, blue char values. Alpha will be set to 255.
pub fn rgbf(r: f32, g: f32, b: f32) -> Self
[src]
pub fn rgbf(r: f32, g: f32, b: f32) -> Self
[src]Returns a color value from red, green, blue float values. Alpha will be set to 1.0.
pub fn rgba(r: u8, g: u8, b: u8, a: u8) -> Self
[src]
pub fn rgba(r: u8, g: u8, b: u8, a: u8) -> Self
[src]Returns a color value from red, green, blue and alpha char values.
pub fn rgbaf(r: f32, g: f32, b: f32, a: f32) -> Self
[src]
pub fn rgbaf(r: f32, g: f32, b: f32, a: f32) -> Self
[src]Returns a color value from red, green, blue and alpha char values.
pub fn hsl(h: f32, s: f32, l: f32) -> Self
[src]
pub fn hsl(h: f32, s: f32, l: f32) -> Self
[src]Returns color value specified by hue, saturation and lightness. HSL values are all in range [0..1], alpha will be set to 1.0.
pub fn hsla(h: f32, s: f32, l: f32, a: f32) -> Self
[src]
pub fn hsla(h: f32, s: f32, l: f32, a: f32) -> Self
[src]Returns color value specified by hue, saturation, lightness and alpha. All values are in range [0..1]
pub fn hex(raw_hex: &str) -> Self
[src]
pub fn hex(raw_hex: &str) -> Self
[src]Returns color value for a 6-digit (RRGGBB
) or 8-digit (RRGGBBAA
)
HTML hexadecimal string. Any other length produces rgb(0,0,0)
.
The “#” is optional.
pub fn set_alphaf(&mut self, a: f32)
[src]
pub fn set_alphaf(&mut self, a: f32)
[src]Sets transparency of a color value.
pub fn premultiplied(self) -> Self
[src]
pub fn to_array(self) -> [f32; 4]
[src]
pub fn is_black(&self) -> bool
[src]
Trait Implementations
impl PartialOrd<Color> for Color
[src]
impl PartialOrd<Color> for Color
[src]fn partial_cmp(&self, other: &Color) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Color) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Color
[src]
impl StructuralPartialEq for Color
[src]
Auto Trait Implementations
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more