38 #ifdef CLAW_PNG_SUPPORT 42 #endif // CLAW_PNG_SUPPORT 44 #ifdef CLAW_JPEG_SUPPORT 46 #endif // CLAW_JPEG_SUPPORT 56 return super::begin();
75 return super::begin();
140 std::swap(m_data, that.m_data);
149 if ( m_data.empty() )
152 return m_data[0].size();
161 return m_data.size();
222 if ( my_box.intersects( his_box ) )
225 unsigned int that_y = pos.
y < 0 ? -pos.
y : 0;
226 unsigned int that_x = pos.
x < 0 ? -pos.
x : 0;
227 const double max_comp
228 ( std::numeric_limits<rgba_pixel::component_type>::max() );
230 intersection = my_box.intersection( his_box );
232 for (
int y=0; y!=intersection.
height; ++y)
239 for( ; first!=last; ++first, ++dest )
241 const double src_alpha( first->components.alpha );
242 const double dest_alpha
243 ( dest->components.alpha * (max_comp - src_alpha) );
246 (double)first->components.red * src_alpha
247 + (
double)dest->components.red * dest_alpha;
249 (double)first->components.green * src_alpha
250 + (
double)dest->components.green * dest_alpha;
252 (double)first->components.blue * src_alpha
253 + (
double)dest->components.blue * dest_alpha;
254 const double alpha = src_alpha + dest_alpha;
256 dest->components.red = std::min(red, max_comp);
257 dest->components.green = std::min(green, max_comp);
258 dest->components.blue = std::min(blue, max_comp);
259 dest->components.alpha = std::min(alpha, max_comp);
277 if ( my_box.intersects( his_box ) )
280 unsigned int that_y = pos.
y < 0 ? -pos.
y : 0;
281 unsigned int that_x = pos.
x < 0 ? -pos.
x : 0;
283 intersection = my_box.intersection( his_box );
285 for (
int y=0; y!=intersection.
height; ++y)
292 std::copy( first, last, dest );
303 for (
unsigned int y=0; y!=
height()/2; ++y)
304 std::swap( m_data[y], m_data[
height()-y-1] );
318 if ( my_box.intersects( r ) )
321 const double max_comp
322 ( std::numeric_limits<rgba_pixel::component_type>::max() );
324 for (
int y=0; y!=intersection.height; ++y)
327 (*this)[intersection.position.y + y].begin()
328 + intersection.position.x;
331 for( ; first!=last; ++first )
336 (double)first->components.red
337 + src_alpha * (
double)c.
components.red / max_comp;
339 (double)first->components.green
340 + src_alpha * (
double)c.
components.green / max_comp;
342 (double)first->components.blue
343 + src_alpha * (
double)c.
components.blue / max_comp;
344 double alpha = (double)first->components.alpha
345 + (max_comp - src_alpha) / max_comp;
347 first->components.red = std::min(red, max_comp);
348 first->components.green = std::min(green, max_comp);
349 first->components.blue = std::min(blue, max_comp);
350 first->components.alpha = std::min(alpha, max_comp);
371 for (
unsigned int y=0; y!=
height(); ++y)
385 #ifdef CLAW_JPEG_SUPPORT 389 #endif // CLAW_JPEG_SUPPORT 391 #ifdef CLAW_PNG_SUPPORT 395 #endif // CLAW_PNG_SUPPORT This class read data from a pcx file and store it in an image.
unsigned int height() const
Gets image's height.
This class read data from a png file and store it in an image.
This class reads data from a gif file. The image is resized to the size of the screen (as defined in ...
coordinate_2d< value_type > position
value_typeop left coordinates.
This class read data from a bitmap file and store it in an image.
void partial_copy(const image &that, const math::coordinate_2d< int > &pos)
Copy an image on the current image.
A class for jpeg pictures.
super::const_iterator const_iterator
Const iterator in the line.
iterator end()
Get an iterator pointing just past the last pixel.
struct claw::graphic::rgba_pixel::@15::@17 components
Component by component representation.
This class read data from a targa file and store it in an image.
unsigned int width() const
Gets image's width.
super::size_type size_type
An unsigned integral type.
void flip()
Set the image upside down.
void swap(image &that)
Swap the content of two images.
void fill(const math::rectangle< int > r, const pixel_type &c)
Fill an area of the image with a given color.
Fuction object to get the first element of a std::pair.
A class for png pictures.
Base class for iterators on an image.
iterator end()
Get en iterator past the last pixel.
void load(std::istream &f)
Read the image from a stream.
A class representing a rectangle by his x,y coordinates, width and height.
A class for bitmap pictures.
This class read data from a xbm file and store it in an image.
Image class for gif files.
This class read data from a jpeg file and store it in an image.
image()
Constructor. Creates an image without datas.
void swap(claw::tween::tweener &a, claw::tween::tweener &b)
Swap two tweeners.
value_type y
Y-coordinate.
super::iterator iterator
Iterator in the line.
A class for pcx pictures.
A simple class to use as exception with string message.
void merge(const image &that)
Merge an image on the current image.
iterator begin()
Get an iterator on the first pixel.
iterator begin()
Get an iterator pointing on the first pixel.
A class to deal with images.
A class for targa pictures.
A class for xbm pictures.
void set_size(unsigned int w, unsigned int h)
Set a new size to the image.
value_type x
X-coordinate.
size_type size() const
Get the length of the line.
A class to deal with images.