Struct radiant_rs::Color[][src]

pub struct Color(pub f32, pub f32, pub f32, pub f32);

A color value consisting of four floating point values for the color channels red, green, blue and alpha.

Various drawing methods accept color instances to be used as multiplicators in the drawing process, e.g. Sprite::draw() allows multiplying the sprite- texture's color channels by given color.

Methods

impl Color
[src]

TRANSPARENT: Color = Color(0.0, 0.0, 0.0, 0.0)

WHITE: Color = Color(1.0, 1.0, 1.0, 1.0)

BLACK: Color = Color(0.0, 0.0, 0.0, 1.0)

RED: Color = Color(1.0, 0.0, 0.0, 1.0)

GREEN: Color = Color(0.0, 1.0, 0.0, 1.0)

BLUE: Color = Color(0.0, 0.0, 1.0, 1.0)

YELLOW: Color = Color(1.0, 1.0, 0.0, 1.0)

CYAN: Color = Color(0.0, 1.0, 1.0, 1.0)

MAGENTA: Color = Color(1.0, 0.0, 1.0, 1.0)

Creates a new instance with color channels set to one and the alpha channel set to given value.

Creates a new instance with color channels set to zero and the alpha channel set to given value.

Creates a new instance with all channels set to given value.

Creates a new instance with color channels set to given value and the alpha channel set to one.

Creates a new instance from given HSL (range 0.0 - 1.0)

Creates a new instance from given color-temperature (~1000 to ~40000).

Based on http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/

Returns value of the instance's red channel.

Returns value of the instance's green channel.

Returns value of the instance's blue channel.

Returns value of the instance's alpha channel.

Sets the instance's channels from another color object.

Sets a value for the instance's red channel

Sets a value for the instance's green channel.

Sets a value for the instance's blue channel.

Sets a value for the instance's alpha channel.

Multiplies the instance's color channels by given scaling factor. Does not modify alpha.

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 Debug for Color
[src]

Formats the value using the given formatter. Read more

impl Default for Color
[src]

Returns the "default value" for a type. 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<T> From<(T, T, T, T)> for Color where
    f32: From<T>, 
[src]

Performs the conversion.

impl<T> From<[T; 4]> for Color where
    T: Copy,
    f32: From<T>, 
[src]

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

impl<'a> From<&'a Color> for (f32, f32, f32, f32)
[src]

Performs the conversion.

impl AsUniform for Color
[src]

Auto Trait Implementations

impl Send for Color

impl Sync for Color