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

Red component.

Green component.

Blue component.

Alpha (opacity) component.

Methods

impl Color
[src]

[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

[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

BLACK: Self = Self{r: 0, g: 0, b: 0, a: 255,}

Black predefined color

WHITE: Self = Self{r: 255, g: 255, b: 255, a: 255,}

White predefined color

RED: Self = Self{r: 255, g: 0, b: 0, a: 255,}

Red predefined color

GREEN: Self = Self{r: 0, g: 255, b: 0, a: 255,}

Green predefined color

BLUE: Self = Self{r: 0, g: 0, b: 255, a: 255,}

Blue predefined color

YELLOW: Self = Self{r: 255, g: 255, b: 0, a: 255,}

Yellow predefined color

MAGENTA: Self = Self{r: 255, g: 0, b: 255, a: 255,}

Magenta predefined color

CYAN: Self = Self{r: 0, g: 255, b: 255, a: 255,}

Cyan predifined color

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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for Color
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for Color
[src]

impl Debug for Color
[src]

[src]

Formats the value using the given formatter.

impl From<u32> for Color
[src]

[src]

Construct the color from 32-bit unsigned integer.

The number should contain the components in RGBA order.

impl Into<u32> for Color
[src]

[src]

Retrieve the color as a 32-bit unsigned integer.

impl Add for Color
[src]

The resulting type after applying the + operator.

[src]

Calculate the component-wise saturated addition of two colors.

impl AddAssign for Color
[src]

[src]

Performs the += operation.

impl Sub for Color
[src]

The resulting type after applying the - operator.

[src]

Component-wise subtraction of two colors. Components below 0 are clamped to 0.

impl SubAssign for Color
[src]

[src]

Performs the -= operation.

impl Mul for Color
[src]

The resulting type after applying the * operator.

[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]

[src]

Performs the *= operation.