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