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(dest->components.alpha);
245 (double)first->components.red
246 + dest_alpha * (
double)dest->components.red / max_comp;
248 (double)first->components.green
249 + dest_alpha * (
double)dest->components.green / max_comp;
251 (double)first->components.blue
252 + dest_alpha * (
double)dest->components.blue / max_comp;
253 double alpha = src_alpha + (max_comp - dest_alpha) / max_comp;
255 dest->components.red = std::min(red, max_comp);
256 dest->components.green = std::min(green, max_comp);
257 dest->components.blue = std::min(blue, max_comp);
258 dest->components.alpha = std::min(alpha, max_comp);
276 if ( my_box.intersects( his_box ) )
279 unsigned int that_y = pos.
y < 0 ? -pos.
y : 0;
280 unsigned int that_x = pos.
x < 0 ? -pos.
x : 0;
282 intersection = my_box.intersection( his_box );
284 for (
int y=0; y!=intersection.
height; ++y)
291 std::copy( first, last, dest );
302 for (
unsigned int y=0; y!=
height()/2; ++y)
303 std::swap( m_data[y], m_data[
height()-y-1] );
317 if ( my_box.intersects( r ) )
320 const double max_comp
321 ( std::numeric_limits<rgba_pixel::component_type>::max() );
323 for (
int y=0; y!=intersection.height; ++y)
326 (*this)[intersection.position.y + y].begin()
327 + intersection.position.x;
330 for( ; first!=last; ++first )
335 (double)first->components.red
336 + src_alpha * (
double)c.
components.red / max_comp;
338 (double)first->components.green
339 + src_alpha * (
double)c.
components.green / max_comp;
341 (double)first->components.blue
342 + src_alpha * (
double)c.
components.blue / max_comp;
343 double alpha = (double)first->components.alpha
344 + (max_comp - src_alpha) / max_comp;
346 first->components.red = std::min(red, max_comp);
347 first->components.green = std::min(green, max_comp);
348 first->components.blue = std::min(blue, max_comp);
349 first->components.alpha = std::min(alpha, max_comp);
370 for (
unsigned int y=0; y!=
height(); ++y)
384 #ifdef CLAW_JPEG_SUPPORT 388 #endif // CLAW_JPEG_SUPPORT 390 #ifdef CLAW_PNG_SUPPORT 394 #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.