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]

Creates a new instance with a channels set to zero.

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.

Deprecated since 0.2

: Use into() instead

Returns the instance's channels as a tuple.

Returns opaque white color.

Returns opaque black color.

Returns opaque red color.

Returns opaque green color.

Returns opaque blue color.

Returns opaque yellow color.

Returns opaque cyan color.

Returns opaque magenta color.

Deprecated since 0.2

: Use magenta() instead

Returns opaque magenta color.

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

Returns the "default value" for a type. Read more

impl<T> From<(T, T, T, T)> for Color where T: Debug + Float, f32: From<T>
[src]

Performs the conversion.

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

Performs the conversion.

impl AsUniform for Color
[src]

impl Debug for Color
[src]

Formats the value using the given formatter.