[][src]Struct femtovg::Color

pub struct Color {
    pub r: f32,
    pub g: f32,
    pub b: f32,
    pub a: f32,
}

Struct for representing colors.

Fields

r: f32g: f32b: f32a: 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]

impl StructuralPartialEq for Color[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.