[go: up one dir, main page]

[][src]Enum piet_common::Color

pub enum Color {
    Rgba32(u32),
}

A datatype representing color.

Currently this is only a 32 bit RGBA value, but it will likely extend to some form of wide-gamut colorspace, and in the meantime is useful for giving programs proper type.

Variants

Rgba32(u32)

Methods

impl Color[src]

pub const fn rgba32(rgba: u32) -> Color[src]

Create a color from a 32-bit rgba value (alpha as least significant byte).

pub const fn rgb24(rgb: u32) -> Color[src]

Create a color from a 24-bit rgb value (red most significant, blue least).

pub fn rgba<F>(r: F, g: F, b: F, a: F) -> Color where
    F: Into<f64>, 
[src]

Create a color from four floating point values, each in the range 0.0 to 1.0.

The interpretation is the same as rgba32, and no greater precision is (currently) assumed.

pub fn rgb<F>(r: F, g: F, b: F) -> Color where
    F: Into<f64>, 
[src]

Create a color from three floating point values, each in the range 0.0 to 1.0.

The interpretation is the same as rgb24, and no greater precision is (currently) assumed.

pub fn as_rgba32(&self) -> u32[src]

Convert a color value to a 32-bit rgba value.

pub const WHITE: Color[src]

Opaque white.

pub const BLACK: Color[src]

Opaque black.

Trait Implementations

impl Clone for Color[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Color

impl Sync for Color

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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

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

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

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

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 
[src]