RGBA pixel. More...
#include <pixel.hpp>
Public Types | |
typedef unsigned char | component_type |
Public Member Functions | |
rgba_pixel () | |
Default constructor. | |
rgba_pixel (component_type r, component_type g, component_type b, component_type a) | |
Constructor. | |
rgba_pixel & | operator= (const rgb_pixel &that) |
Assignement operator. | |
bool | operator== (const rgba_pixel &that) const |
Tell if two pixels are equal. | |
bool | operator!= (const rgba_pixel &that) const |
Tell if two pixels are different. | |
component_type | luminosity () const |
Get the luminosity of the pixel. | |
Public Attributes | |
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. |
RGBA pixel.
Definition at line 75 of file pixel.hpp.
typedef unsigned char claw::graphic::rgba_pixel::component_type |
claw::graphic::rgba_pixel::rgba_pixel | ( | ) |
claw::graphic::rgba_pixel::rgba_pixel | ( | component_type | r, | |
component_type | g, | |||
component_type | b, | |||
component_type | a | |||
) |
Constructor.
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 171 of file pixel.cpp.
00172 { 00173 components.red = r; 00174 components.green = g; 00175 components.blue = b; 00176 components.alpha = a; 00177 } // rgba_pixel::rgba_pixel()
claw::graphic::rgba_pixel::component_type claw::graphic::rgba_pixel::luminosity | ( | ) | const |
Get the luminosity of the pixel.
The luminosity is approximated with integers:
Definition at line 227 of file pixel.cpp.
References components.
00228 { 00229 return ((unsigned int)components.red * 183 00230 + (unsigned int)components.green * 54 00231 + (unsigned int)components.blue * 18 00232 ) / 256; 00233 } // rgba_pixel::luminosity()
bool claw::graphic::rgba_pixel::operator!= | ( | const rgba_pixel & | that | ) | const |
claw::graphic::rgba_pixel & claw::graphic::rgba_pixel::operator= | ( | const rgb_pixel & | that | ) |
Assignement operator.
that | The other pixel. |
Definition at line 186 of file pixel.cpp.
References claw::graphic::rgb_pixel::blue, claw::graphic::rgb_pixel::components, components, claw::graphic::rgb_pixel::green, and claw::graphic::rgb_pixel::red.
00187 { 00188 components.red = that.components.red; 00189 components.green = that.components.green; 00190 components.blue = that.components.blue; 00191 components.alpha = 255; 00192 00193 return *this; 00194 } // rgba_pixel::operator=()
bool claw::graphic::rgba_pixel::operator== | ( | const rgba_pixel & | that | ) | const |
Translucy.
Definition at line 95 of file pixel.hpp.
Referenced by claw::graphic::targa::reader::file_input_buffer< Pixel >::get_pixel(), claw::graphic::jpeg::reader::grayscale_to_pixel32::operator()(), claw::graphic::jpeg::reader::RGB_to_pixel32::operator()(), and claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes().
Blue component.
Definition at line 92 of file pixel.hpp.
Referenced by claw::graphic::targa::reader::file_input_buffer< Pixel >::get_pixel(), claw::graphic::jpeg::reader::grayscale_to_pixel32::operator()(), claw::graphic::jpeg::reader::RGB_to_pixel32::operator()(), claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes(), and claw::graphic::rgb_pixel::rgb_pixel().
struct { ... } claw::graphic::rgba_pixel::components |
Component by component representation.
Referenced by claw::graphic::targa::reader::file_input_buffer< Pixel >::get_pixel(), luminosity(), claw::graphic::jpeg::reader::grayscale_to_pixel32::operator()(), claw::graphic::jpeg::reader::RGB_to_pixel32::operator()(), operator=(), claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes(), and claw::graphic::rgb_pixel::rgb_pixel().
Green component.
Definition at line 89 of file pixel.hpp.
Referenced by claw::graphic::targa::reader::file_input_buffer< Pixel >::get_pixel(), claw::graphic::jpeg::reader::grayscale_to_pixel32::operator()(), claw::graphic::jpeg::reader::RGB_to_pixel32::operator()(), claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes(), and claw::graphic::rgb_pixel::rgb_pixel().
unsigned int claw::graphic::rgba_pixel::pixel |
Compressed representation.
Definition at line 80 of file pixel.hpp.
Referenced by operator!=(), and operator==().
Red component.
Definition at line 86 of file pixel.hpp.
Referenced by claw::graphic::targa::reader::file_input_buffer< Pixel >::get_pixel(), claw::graphic::jpeg::reader::grayscale_to_pixel32::operator()(), claw::graphic::jpeg::reader::RGB_to_pixel32::operator()(), claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes(), and claw::graphic::rgb_pixel::rgb_pixel().