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]
fn transparent() -> Color
Creates a new instance with a channels set to zero.
fn alpha(alpha: f32) -> Color
Creates a new instance with color channels set to one and the alpha channel set to given value.
fn alpha_mask(alpha: f32) -> Color
Creates a new instance with color channels set to zero and the alpha channel set to given value.
fn alpha_pm(alpha: f32) -> Color
Creates a new instance with all channels set to given value.
fn lightness(value: f32) -> Color
Creates a new instance with color channels set to given value and the alpha channel set to one.
fn from_hsl(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
Creates a new instance from given HSL (range 0.0 - 1.0)
fn from_temperature(temperature: f32, alpha: f32) -> Color
Creates a new instance from given color-temperature (~1000 to ~40000).
Based on http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
fn r(&self) -> f32
Returns value of the instance's red channel.
fn g(&self) -> f32
Returns value of the instance's green channel.
fn b(&self) -> f32
Returns value of the instance's blue channel.
fn a(&self) -> f32
Returns value of the instance's alpha channel.
fn set(&mut self, value: Color)
Sets the instance's channels from another color object.
fn set_r(&mut self, value: f32) -> &mut Color
Sets a value for the instance's red channel
fn set_g(&mut self, value: f32) -> &mut Color
Sets a value for the instance's green channel.
fn set_b(&mut self, value: f32) -> &mut Color
Sets a value for the instance's blue channel.
fn set_a(&mut self, value: f32) -> &mut Color
Sets a value for the instance's alpha channel.
fn scale(&mut self, scaling: f32) -> &mut Color
Multiplies the instance's color channels by given scaling factor. Does not modify alpha.
fn as_tuple(&self) -> (f32, f32, f32, f32)
: Use into() instead
Returns the instance's channels as a tuple.
fn white() -> Color
Returns opaque white color.
fn black() -> Color
Returns opaque black color.
fn red() -> Color
Returns opaque red color.
fn green() -> Color
Returns opaque green color.
fn blue() -> Color
Returns opaque blue color.
fn yellow() -> Color
Returns opaque yellow color.
fn cyan() -> Color
Returns opaque cyan color.
fn magenta() -> Color
Returns opaque magenta color.
fn puple() -> Color
: Use magenta() instead
Returns opaque magenta color.
Trait Implementations
impl Copy for Color
[src]
impl Clone for Color
[src]
fn clone(&self) -> Color
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more