49 ( 0, 0, 0, std::numeric_limits<rgba_pixel::component_type>::max() );
51 ( std::numeric_limits<rgba_pixel::component_type>::max(),
52 std::numeric_limits<rgba_pixel::component_type>::max(),
53 std::numeric_limits<rgba_pixel::component_type>::max(),
54 std::numeric_limits<rgba_pixel::component_type>::max() );
57 ( 0, 0, std::numeric_limits<rgba_pixel::component_type>::max(),
58 std::numeric_limits<rgba_pixel::component_type>::max() );
60 ( 0, std::numeric_limits<rgba_pixel::component_type>::max(), 0,
61 std::numeric_limits<rgba_pixel::component_type>::max() );
63 ( std::numeric_limits<rgba_pixel::component_type>::max(), 0, 0,
64 std::numeric_limits<rgba_pixel::component_type>::max() );
67 ( std::numeric_limits<rgba_pixel::component_type>::max(),
68 std::numeric_limits<rgba_pixel::component_type>::max(), 0,
69 std::numeric_limits<rgba_pixel::component_type>::max() );
71 ( std::numeric_limits<rgba_pixel::component_type>::max(), 0,
72 std::numeric_limits<rgba_pixel::component_type>::max(),
73 std::numeric_limits<rgba_pixel::component_type>::max() );
75 ( 0, std::numeric_limits<rgba_pixel::component_type>::max(),
76 std::numeric_limits<rgba_pixel::component_type>::max(),
77 std::numeric_limits<rgba_pixel::component_type>::max() );
104 components.green = g;
127 std::istringstream iss(c);
133 if ( !(iss >> std::hex >> color) )
134 throw std::invalid_argument(c);
136 components.red = (color & 0xFF0000) >> (CHAR_BIT * 2);
137 components.green = (color & 0x00FF00) >> CHAR_BIT;
138 components.blue = color & 0x0000FF;
170 return !(*
this == that);
180 return !(*
this == that);
206 components.alpha = 255;
221 components.green = g;
223 components.alpha = a;
233 std::istringstream iss(c);
240 has_alpha = c.length() > 7;
243 has_alpha = c.length() > 6;
245 if ( !((iss >> std::hex >> color) && (iss.rdbuf()->in_avail() == 0)) )
246 throw std::invalid_argument(c);
249 components.alpha = (color & 0xFF000000) >> (CHAR_BIT * 3);
251 components.alpha = std::numeric_limits<component_type>::max();
253 components.red = (color & 0xFF0000) >> (CHAR_BIT * 2);
254 components.green = (color & 0x00FF00) >> CHAR_BIT;
255 components.blue = color & 0x0000FF;
270 components.alpha = 255;
282 return pixel == that.
pixel;
292 return pixel != that.
pixel;
308 return ((
unsigned int)components.red * 183
309 + (
unsigned int)components.green * 54
310 + (
unsigned int)components.blue * 18
bool operator!=(const rgb_pixel &that) const
Compare to a pixel.
rgba_pixel green_pixel(0, std::numeric_limits< rgba_pixel::component_type >::max(), 0, std::numeric_limits< rgba_pixel::component_type >::max())
The green color.
unsigned_integer_of_size< 32 >::type u_int_32
An unsigned integer on 32 bits.
rgba_pixel cyan_pixel(0, std::numeric_limits< rgba_pixel::component_type >::max(), std::numeric_limits< rgba_pixel::component_type >::max(), std::numeric_limits< rgba_pixel::component_type >::max())
The cyan color.
bool operator!=(const rgba_pixel &that) const
Tell if two pixels are different.
rgba_pixel transparent_pixel(0, 0, 0, 0)
A transparent color.
component_type red
Red component.
Some classes for the raw manipulation of the base types.
struct claw::graphic::rgba_pixel::@15::@17 components
Component by component representation.
rgba_pixel black_pixel(0, 0, 0, std::numeric_limits< rgba_pixel::component_type >::max())
The black color.
unsigned int pixel
Compressed representation.
rgb_pixel()
Default constructor.
rgba_pixel & operator=(const rgb_pixel &that)
Assignement operator.
component_type blue
Blue component.
struct claw::graphic::rgb_pixel::@14 components
Component by component representation.
bool operator==(const rgba_pixel &that) const
Tell if two pixels are equal.
component_type luminosity() const
Get the luminosity of the pixel.
component_type red
Red component.
rgba_pixel yellow_pixel
The yellow color.
rgba_pixel magenta_pixel
The magenta color.
rgba_pixel red_pixel
The red color.
bool operator==(const rgb_pixel &that) const
Compare to a pixel.
unsigned char component_type
The type of the components of the color.
rgba_pixel()
Default constructor.
Representation of a pixel in image processing.
unsigned char component_type
The type of the components of the color.
rgba_pixel white_pixel
The white color.
This is the main namespace.
component_type green
Green component.
rgba_pixel blue_pixel(0, 0, std::numeric_limits< rgba_pixel::component_type >::max(), std::numeric_limits< rgba_pixel::component_type >::max())
The blue color.