Claw 1.7.3
|
A class to deal with images. More...
#include <image.hpp>
Classes | |
class | base_iterator |
Base class for iterators on an image. More... | |
class | scanline |
One line in the image. More... | |
Public Types | |
typedef rgba_pixel | pixel_type |
The type representing the colors of the pixels in the image. | |
typedef base_iterator< image, pixel_type > | iterator |
The type of the iterator on the pixels of the image. | |
typedef base_iterator< const image, const pixel_type > | const_iterator |
The type of the iterator to access constant pixels. | |
Public Member Functions | |
image () | |
Constructor. Creates an image without datas. | |
image (unsigned int w, unsigned int h) | |
Constructor. Creates an empty image. | |
image (std::istream &f) | |
Constructor. Reads an image from an input stream. | |
void | swap (image &that) |
Swap the content of two images. | |
unsigned int | width () const |
Gets image's width. | |
unsigned int | height () const |
Gets image's height. | |
scanline & | operator[] (unsigned int i) |
Gets a line of the image. | |
const scanline & | operator[] (unsigned int i) const |
Gets a line of the image. | |
iterator | begin () |
Get an iterator pointing on the first pixel. | |
iterator | end () |
Get an iterator pointing just past the last pixel. | |
const_iterator | begin () const |
Get an iterator pointing on the first pixel. | |
const_iterator | end () const |
Get an iterator pointing just past the last pixel. | |
void | merge (const image &that) |
Merge an image on the current image. | |
void | merge (const image &that, const math::coordinate_2d< int > &pos) |
Merge an image on the current image. | |
void | partial_copy (const image &that, const math::coordinate_2d< int > &pos) |
Copy an image on the current image. | |
void | flip () |
Set the image upside down. | |
void | fill (const math::rectangle< int > r, const pixel_type &c) |
Fill an area of the image with a given color. | |
void | set_size (unsigned int w, unsigned int h) |
Set a new size to the image. | |
void | load (std::istream &f) |
Read the image from a stream. | |
base_iterator<const image, const pixel_type> claw::graphic::image::const_iterator |
claw::graphic::image::image | ( | ) |
claw::graphic::image::image | ( | unsigned int | w, |
unsigned int | h ) |
Constructor. Creates an empty image.
w | Image's width. |
h | Image's height. |
Definition at line 128 of file image.cpp.
References set_size().
claw::graphic::image::image | ( | std::istream & | f | ) |
claw::graphic::image::iterator claw::graphic::image::begin | ( | ) |
Get an iterator pointing on the first pixel.
Definition at line 168 of file image.cpp.
Referenced by merge(), and partial_copy().
claw::graphic::image::const_iterator claw::graphic::image::begin | ( | ) | const |
claw::graphic::image::iterator claw::graphic::image::end | ( | ) |
claw::graphic::image::const_iterator claw::graphic::image::end | ( | ) | const |
void claw::graphic::image::fill | ( | const math::rectangle< int > | r, |
const pixel_type & | c ) |
Fill an area of the image with a given color.
r | The area to fill. |
c | The color to fill with. |
Definition at line 313 of file image.cpp.
References claw::graphic::rgba_pixel::alpha, claw::graphic::rgba_pixel::blue, claw::graphic::rgba_pixel::components, claw::graphic::rgba_pixel::green, height(), claw::math::rectangle< T >::height, claw::math::rectangle< T >::position, claw::graphic::rgba_pixel::red, width(), claw::math::rectangle< T >::width, claw::math::coordinate_2d< T >::x, and claw::math::coordinate_2d< T >::y.
void claw::graphic::image::flip | ( | ) |
unsigned int claw::graphic::image::height | ( | ) | const |
Gets image's height.
Definition at line 159 of file image.cpp.
Referenced by end(), end(), fill(), flip(), merge(), partial_copy(), and set_size().
void claw::graphic::image::load | ( | std::istream & | f | ) |
void claw::graphic::image::merge | ( | const image & | that | ) |
void claw::graphic::image::merge | ( | const image & | that, |
const math::coordinate_2d< int > & | pos ) |
Merge an image on the current image.
that | The image to merge. |
pos | The position of the top left corner. |
Definition at line 216 of file image.cpp.
References begin(), height(), claw::math::rectangle< T >::height, claw::math::rectangle< T >::position, width(), claw::math::rectangle< T >::width, claw::math::coordinate_2d< T >::x, and claw::math::coordinate_2d< T >::y.
|
inline |
|
inline |
void claw::graphic::image::partial_copy | ( | const image & | that, |
const math::coordinate_2d< int > & | pos ) |
Copy an image on the current image.
that | The image to copy. |
pos | The position of the top left corner. |
Definition at line 271 of file image.cpp.
References begin(), height(), claw::math::rectangle< T >::height, claw::math::rectangle< T >::position, width(), claw::math::rectangle< T >::width, claw::math::coordinate_2d< T >::x, and claw::math::coordinate_2d< T >::y.
void claw::graphic::image::set_size | ( | unsigned int | w, |
unsigned int | h ) |
void claw::graphic::image::swap | ( | image & | that | ) |
Swap the content of two images.
that | The image to swap with. |
Definition at line 138 of file image.cpp.
Referenced by std::swap().
unsigned int claw::graphic::image::width | ( | ) | const |