43 rgba_pixel transparent_pixel( 0, 0, 0, 0 );
45 rgba_pixel black_pixel
46 ( 0, 0, 0, std::numeric_limits<rgba_pixel::component_type>::max() );
47 rgba_pixel white_pixel
48 ( std::numeric_limits<rgba_pixel::component_type>::max(),
49 std::numeric_limits<rgba_pixel::component_type>::max(),
50 std::numeric_limits<rgba_pixel::component_type>::max(),
51 std::numeric_limits<rgba_pixel::component_type>::max() );
54 ( 0, 0, std::numeric_limits<rgba_pixel::component_type>::max(),
55 std::numeric_limits<rgba_pixel::component_type>::max() );
56 rgba_pixel green_pixel
57 ( 0, std::numeric_limits<rgba_pixel::component_type>::max(), 0,
58 std::numeric_limits<rgba_pixel::component_type>::max() );
60 ( std::numeric_limits<rgba_pixel::component_type>::max(), 0, 0,
61 std::numeric_limits<rgba_pixel::component_type>::max() );
63 rgba_pixel yellow_pixel
64 ( std::numeric_limits<rgba_pixel::component_type>::max(),
65 std::numeric_limits<rgba_pixel::component_type>::max(), 0,
66 std::numeric_limits<rgba_pixel::component_type>::max() );
67 rgba_pixel magenta_pixel
68 ( std::numeric_limits<rgba_pixel::component_type>::max(), 0,
69 std::numeric_limits<rgba_pixel::component_type>::max(),
70 std::numeric_limits<rgba_pixel::component_type>::max() );
72 ( 0, std::numeric_limits<rgba_pixel::component_type>::max(),
73 std::numeric_limits<rgba_pixel::component_type>::max(),
74 std::numeric_limits<rgba_pixel::component_type>::max() );
96 ( component_type r, component_type g, component_type b )
122 std::istringstream iss(c);
128 if ( !(iss >> std::hex >> color) )
129 throw std::invalid_argument(c);
131 components.red = (color & 0xFF0000) >> (CHAR_BIT * 2);
132 components.green = (color & 0x00FF00) >> CHAR_BIT;
133 components.blue = color & 0x0000FF;
165 return !(*
this == that);
175 return !(*
this == that);
201 components.alpha = 255;
213 ( component_type r, component_type g, component_type b, component_type a )
216 components.green = g;
218 components.alpha = a;
228 std::istringstream iss(c);
235 has_alpha = c.length() > 7;
238 has_alpha = c.length() > 6;
240 if ( !((iss >> std::hex >> color) && (iss.rdbuf()->in_avail() == 0)) )
241 throw std::invalid_argument(c);
244 components.alpha = (color & 0xFF000000) >> (CHAR_BIT * 3);
246 components.alpha = std::numeric_limits<component_type>::max();
248 components.red = (color & 0xFF0000) >> (CHAR_BIT * 2);
249 components.green = (color & 0x00FF00) >> CHAR_BIT;
250 components.blue = color & 0x0000FF;
265 components.alpha = 255;
277 return pixel == that.
pixel;
287 return pixel != that.
pixel;
300 claw::graphic::rgba_pixel::component_type
303 return ((
unsigned int)components.red * 183
304 + (
unsigned int)components.green * 54
305 + (
unsigned int)components.blue * 18