[−][src]Struct femtovg::Color
Struct for representing colors.
Fields
r: f32
g: f32
b: f32
a: f32
Implementations
impl Color
[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]
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]
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]
Returns a color value from red, green, blue and alpha char values.
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]
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]
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 white() -> Self
[src]
Returns a white color
pub fn black() -> Self
[src]
Returns a black color
pub fn set_alpha(&mut self, a: u8)
[src]
Sets transparency of a color value.
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 Clone for Color
[src]
impl Copy for Color
[src]
impl Debug for Color
[src]
impl Default for Color
[src]
impl PartialEq<Color> for Color
[src]
impl PartialOrd<Color> for Color
[src]
pub fn partial_cmp(&self, other: &Color) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Color) -> bool
[src]
pub fn le(&self, other: &Color) -> bool
[src]
pub fn gt(&self, other: &Color) -> bool
[src]
pub fn ge(&self, other: &Color) -> bool
[src]
impl StructuralPartialEq for Color
[src]
Auto Trait Implementations
impl RefUnwindSafe for Color
[src]
impl Send for Color
[src]
impl Sync for Color
[src]
impl Unpin for Color
[src]
impl UnwindSafe for Color
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,