Struct ggez::graphics::Color[][src]

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

A RGBA color in the sRGB color space represented as f32's in the range [0.0-1.0]

Fields

Red component

Green component

Blue component

Alpha component

Methods

impl Color
[src]

Create a new Color from four f32's in the range [0.0-1.0]

Create a new Color from four u8's in the range [0-255]

Create a new Color from three u8's in the range [0-255], with the alpha component fixed to 255 (opaque)

Return a tuple of four u8's in the range [0-255] with the Color's components.

Return a tuple of three u8's in the range [0-255] with the Color's components.

Convert a packed u32 containing 0xRRGGBBAA into a Color.conf

Convert a packed u32 containing 0x00RRGGBB into a Color. This lets you do things like Color::from_rgb_u32(0xCD09AA) easily if you want.

Convert a Color into a packed u32, containing 0xRRGGBBAA as bytes.

Convert a Color into a packed u32, containing 0x00RRGGBB as bytes.

Trait Implementations

impl Copy for Color
[src]

impl Clone for Color
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Color
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for Color
[src]

Formats the value using the given formatter. Read more

impl From<(u8, u8, u8, u8)> for Color
[src]

Convert a (R, G, B, A) tuple of u8's in the range 0-255 into a Color

impl From<(u8, u8, u8)> for Color
[src]

Convert a (R, G, B) tuple of u8's in the range 0-255 into a Color, with a value of 255 for the alpha element (ie, no transparency.)

impl From<[f32; 4]> for Color
[src]

Turns an [R, G, B, A] array of f32's into a Color with no format changes. All inputs should be in the range[0.0-1.0]`.

impl From<Color> for (u8, u8, u8, u8)
[src]

Convert a Color into a (R, G, B, A) tuple of u8's in the range of 0-255.

impl From<Color> for (u8, u8, u8)
[src]

Convert a Color into a (R, G, B) tuple of u8's in the range of 0-255, ignoring the alpha term

impl From<Color> for [f32; 4]
[src]

Convert a Color into an [R, G, B, A] array of f32's in the range of [0.0-1.0].

Auto Trait Implementations

impl Send for Color

impl Sync for Color