claw::graphic::rgba_pixel Struct Reference

RGBA pixel. More...

`#include <pixel.hpp>`

## Public Types

typedef unsigned char | component_type
| The type of the components of the color.

## Public Member Functions

| rgba_pixel ()
| Default constructor.
| rgba_pixel (const rgb_pixel &that)
| Constructor. More...
| rgba_pixel (component_type r, component_type g, component_type b, component_type a)
| Constructor. More...
| rgba_pixel (const std::string &c)
| Constructor from a color name or code. More...
rgba_pixel & | operator= (const rgb_pixel &that)
| Assignement operator. More...
bool | operator== (const rgba_pixel &that) const
| Tell if two pixels are equal. More...
bool | operator!= (const rgba_pixel &that) const
| Tell if two pixels are different. More...
component_type | luminosity () const
| Get the luminosity of the pixel. More...

## Public Attributes

union {
unsigned int pixel
| Compressed representation.
struct {
component_type red
| Red component.
component_type green
| Green component.
component_type blue
| Blue component.
component_type alpha
| Translucy.
} components
| Component by component representation.
}; |

## Detailed Description

RGBA pixel.

Definition at line 79 of file pixel.hpp.

## Constructor & Destructor Documentation

## rgba_pixel() [1/3]

claw::graphic::rgba_pixel::rgba_pixel | ( | const rgb_pixel & | that | ) |

Constructor.

Parameters

  that | The other pixel.

Remarks
  The alpha component of this is set to 255.

Definition at line 201 of file pixel.cpp.

References claw::graphic::rgb_pixel::blue, claw::graphic::rgb_pixel::components, claw::graphic::rgb_pixel::green, claw::graphic::rgb_pixel::red, and rgba_pixel().

## rgba_pixel() [2/3]

claw::graphic::rgba_pixel::rgba_pixel | ( | component_type | r,
|  | component_type | g,
|  | component_type | b,
|  | component_type | a
| ) |  |

Constructor.

Parameters

  r | The value of the red field.
  g | The value of the green field.
  b | The value of the blue field.
  a | The value of the alpha field.

Definition at line 218 of file pixel.cpp.

## rgba_pixel() [3/3]

claw::graphic::rgba_pixel::rgba_pixel | ( | const std::string & | c | ) |

explicit

Constructor from a color name or code.

Parameters

  c | The color name or code.

Definition at line 231 of file pixel.cpp.

## Member Function Documentation

## luminosity()

claw::graphic::rgba_pixel::component_type claw::graphic::rgba_pixel::luminosity | ( |  | ) | const

Get the luminosity of the pixel.

Returns
  The luminosity between 0 (dark) and 255 (light).

The luminosity is approximated with integers:

Definition at line 306 of file pixel.cpp.

## operator!=()

bool claw::graphic::rgba_pixel::operator!= | ( | const rgba_pixel & | that | ) | const

Tell if two pixels are different.

Parameters

  that | The other pixel.

Definition at line 290 of file pixel.cpp.

References pixel.

## operator=()

claw::graphic::rgba_pixel & claw::graphic::rgba_pixel::operator= | ( | const rgb_pixel & | that | ) |

Assignement operator.

Parameters

  that | The other pixel.

Remarks
  The alpha component of this is set to 255.

Definition at line 265 of file pixel.cpp.

References claw::graphic::rgb_pixel::blue, claw::graphic::rgb_pixel::components, claw::graphic::rgb_pixel::green, claw::graphic::rgb_pixel::red, and red.

## operator==()

bool claw::graphic::rgba_pixel::operator== | ( | const rgba_pixel & | that | ) | const

Tell if two pixels are equal.

Parameters

  that | The other pixel.

Definition at line 280 of file pixel.cpp.

References pixel.

The documentation for this struct was generated from the following files:

- pixel.hpp
- code/pixel.cpp