Struct sfml::graphics::Color
[−]
[src]
#[repr(C)]pub struct Color { pub r: u8, pub g: u8, pub b: u8, pub a: u8, }
Utility type for manpulating RGBA colors
Color is a simple color type composed of 4 components: Red, Green, Blue, Alpha
Fields
r: u8
Red component.
g: u8
Green component.
b: u8
Blue component.
a: u8
Alpha (opacity) component.
Methods
impl Color[src]
fn rgb(red: u8, green: u8, blue: u8) -> Color[src]
Construct a color from its 3 RGB components
Arguments
- red - Red component (0 .. 255)
- green - -Green component (0 .. 255)
- blue - Blue component (0 .. 255)
Return Color object constructed from the components
fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> Color[src]
Construct a color from its 4 RGBA components
Arguments
- red - Red component (0 .. 255)
- green - -Green component (0 .. 255)
- blue - Blue component (0 .. 255)
- alpha - Alpha component (0 .. 255)
Return Color object constructed from the components
const BLACK: Self
BLACK: Self = Self{r: 0, g: 0, b: 0, a: 255,}
Black predefined color
const WHITE: Self
WHITE: Self = Self{r: 255, g: 255, b: 255, a: 255,}
White predefined color
const RED: Self
RED: Self = Self{r: 255, g: 0, b: 0, a: 255,}
Red predefined color
const GREEN: Self
GREEN: Self = Self{r: 0, g: 255, b: 0, a: 255,}
Green predefined color
const BLUE: Self
BLUE: Self = Self{r: 0, g: 0, b: 255, a: 255,}
Blue predefined color
const YELLOW: Self
YELLOW: Self = Self{r: 255, g: 255, b: 0, a: 255,}
Yellow predefined color
const MAGENTA: Self
MAGENTA: Self = Self{r: 255, g: 0, b: 255, a: 255,}
Magenta predefined color
const CYAN: Self
CYAN: Self = Self{r: 0, g: 255, b: 255, a: 255,}
Cyan predifined color
const TRANSPARENT: Self
TRANSPARENT: Self = Self{r: 0, g: 0, b: 0, a: 0,}
Tranparent predefined color
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 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 Eq for Color[src]
impl Debug for Color[src]
impl From<u32> for Color[src]
fn from(src: u32) -> Self[src]
Construct the color from 32-bit unsigned integer.
The number should contain the components in RGBA order.
impl Into<u32> for Color[src]
impl Add for Color[src]
type Output = Color
The resulting type after applying the + operator.
fn add(self, other: Color) -> Color[src]
Calculate the component-wise saturated addition of two colors.
impl AddAssign for Color[src]
fn add_assign(&mut self, rhs: Self)[src]
Performs the += operation.
impl Sub for Color[src]
type Output = Self
The resulting type after applying the - operator.
fn sub(self, other: Self) -> Self[src]
Component-wise subtraction of two colors. Components below 0 are clamped to 0.
impl SubAssign for Color[src]
fn sub_assign(&mut self, rhs: Self)[src]
Performs the -= operation.
impl Mul for Color[src]
type Output = Color
The resulting type after applying the * operator.
fn mul(self, other: Color) -> Color[src]
Calculate the component-wise modulated multiplication of two colors.
For each X in rgba, result.X = a.X * b.X / 255.
impl MulAssign for Color[src]
fn mul_assign(&mut self, rhs: Self)[src]
Performs the *= operation.