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]
const TRANSPARENT: Color
TRANSPARENT: Color = Color(0.0, 0.0, 0.0, 0.0)
const WHITE: Color
WHITE: Color = Color(1.0, 1.0, 1.0, 1.0)
const BLACK: Color
BLACK: Color = Color(0.0, 0.0, 0.0, 1.0)
const RED: Color
RED: Color = Color(1.0, 0.0, 0.0, 1.0)
const GREEN: Color
GREEN: Color = Color(0.0, 1.0, 0.0, 1.0)
const BLUE: Color
BLUE: Color = Color(0.0, 0.0, 1.0, 1.0)
const YELLOW: Color
YELLOW: Color = Color(1.0, 1.0, 0.0, 1.0)
const CYAN: Color
CYAN: Color = Color(0.0, 1.0, 1.0, 1.0)
const MAGENTA: Color
MAGENTA: Color = Color(1.0, 0.0, 1.0, 1.0)
fn transparent() -> Color
[src]
Creates a new instance with a channels set to zero.
fn white() -> Color
[src]
Returns opaque white color.
fn black() -> Color
[src]
Returns opaque black color.
fn red() -> Color
[src]
Returns opaque red color.
fn green() -> Color
[src]
Returns opaque green color.
fn blue() -> Color
[src]
Returns opaque blue color.
fn yellow() -> Color
[src]
Returns opaque yellow color.
fn cyan() -> Color
[src]
Returns opaque cyan color.
fn magenta() -> Color
[src]
Returns opaque magenta color.
fn alpha(alpha: f32) -> Color
[src]
Creates a new instance with color channels set to one and the alpha channel set to given value.
fn alpha_mask(alpha: f32) -> Color
[src]
Creates a new instance with color channels set to zero and the alpha channel set to given value.
fn alpha_pm(alpha: f32) -> Color
[src]
Creates a new instance with all channels set to given value.
fn lightness(value: f32) -> Color
[src]
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
[src]
Creates a new instance from given HSL (range 0.0 - 1.0)
fn from_temperature(temperature: f32, alpha: f32) -> Color
[src]
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
[src]
Returns value of the instance's red channel.
fn g(&self) -> f32
[src]
Returns value of the instance's green channel.
fn b(&self) -> f32
[src]
Returns value of the instance's blue channel.
fn a(&self) -> f32
[src]
Returns value of the instance's alpha channel.
fn set(&mut self, value: Color)
[src]
Sets the instance's channels from another color object.
fn set_r(&mut self, value: f32) -> &mut Color
[src]
Sets a value for the instance's red channel
fn set_g(&mut self, value: f32) -> &mut Color
[src]
Sets a value for the instance's green channel.
fn set_b(&mut self, value: f32) -> &mut Color
[src]
Sets a value for the instance's blue channel.
fn set_a(&mut self, value: f32) -> &mut Color
[src]
Sets a value for the instance's alpha channel.
fn scale(&mut self, scaling: f32) -> &mut Color
[src]
Multiplies the instance's color channels by given scaling factor. Does not modify alpha.
fn to_pm(&self) -> Color
[src]
Trait Implementations
impl Copy for Color
[src]
impl Clone for Color
[src]
fn clone(&self) -> Color
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Color
[src]
impl PartialEq for Color
[src]
fn eq(&self, __arg_0: &Color) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Color) -> bool
[src]
This method tests for !=
.
impl<T> From<(T, T, T, T)> for Color where
T: Debug + Float,
f32: From<T>,
[src]
T: Debug + Float,
f32: From<T>,
impl<T> From<[T; 4]> for Color where
T: Debug + Float,
f32: From<T>,
[src]
T: Debug + Float,
f32: From<T>,