A class to deal with images.
More...
#include <image.hpp>
|
| 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.
|
|
A class to deal with images.
- Author
- Julien Jorge
Definition at line 50 of file image.hpp.
◆ const_iterator
The type of the iterator to access constant pixels.
The pixels are accessed from the top line to the bottom line, and from the left to the right.
Definition at line 203 of file image.hpp.
◆ iterator
The type of the iterator on the pixels of the image.
The pixels are accessed from the top line to the bottom line, and from the left to the right.
Definition at line 195 of file image.hpp.
◆ pixel_type
The type representing the colors of the pixels in the image.
Definition at line 55 of file image.hpp.
◆ image() [1/3]
claw::graphic::image::image |
( |
| ) |
|
◆ image() [2/3]
claw::graphic::image::image |
( |
unsigned int | w, |
|
|
unsigned int | h ) |
Constructor. Creates an empty image.
- Parameters
-
w | Image's width. |
h | Image's height. |
- Precondition
- w > 0 and h > 0
Definition at line 113 of file image.cpp.
◆ image() [3/3]
claw::graphic::image::image |
( |
std::istream & | f | ) |
|
Constructor. Reads an image from an input stream.
- Parameters
-
f | The stream to read from. |
Definition at line 102 of file image.cpp.
◆ begin() [1/2]
Get an iterator pointing on the first pixel.
Definition at line 149 of file image.cpp.
◆ begin() [2/2]
Get an iterator pointing on the first pixel.
Definition at line 165 of file image.cpp.
◆ end() [1/2]
Get an iterator pointing just past the last pixel.
Definition at line 157 of file image.cpp.
◆ end() [2/2]
Get an iterator pointing just past the last pixel.
Definition at line 173 of file image.cpp.
◆ fill()
Fill an area of the image with a given color.
- Parameters
-
r | The area to fill. |
c | The color to fill with. |
Definition at line 286 of file image.cpp.
◆ flip()
void claw::graphic::image::flip |
( |
| ) |
|
Set the image upside down.
Definition at line 275 of file image.cpp.
◆ height()
unsigned int claw::graphic::image::height |
( |
| ) |
const |
Gets image's height.
Definition at line 141 of file image.cpp.
◆ load()
void claw::graphic::image::load |
( |
std::istream & | f | ) |
|
Read the image from a stream.
- Parameters
-
f | The stream to read from. |
Definition at line 350 of file image.cpp.
◆ merge() [1/2]
void claw::graphic::image::merge |
( |
const image & | that | ) |
|
Merge an image on the current image.
- Parameters
-
Definition at line 182 of file image.cpp.
◆ merge() [2/2]
Merge an image on the current image.
- Parameters
-
that | The image to merge. |
pos | The position of the top left corner. |
Definition at line 192 of file image.cpp.
◆ operator[]() [1/2]
Gets a line of the image.
Definition at line 429 of file image.ipp.
◆ operator[]() [2/2]
Gets a line of the image.
Definition at line 439 of file image.ipp.
◆ partial_copy()
Copy an image on the current image.
- Parameters
-
that | The image to copy. |
pos | The position of the top left corner. |
Definition at line 245 of file image.cpp.
◆ set_size()
void claw::graphic::image::set_size |
( |
unsigned int | w, |
|
|
unsigned int | h ) |
Set a new size to the image.
- Precondition
- (w!=0) && (h!=0)
Definition at line 333 of file image.cpp.
◆ swap()
void claw::graphic::image::swap |
( |
image & | that | ) |
|
Swap the content of two images.
- Parameters
-
that | The image to swap with. |
Definition at line 122 of file image.cpp.
◆ width()
unsigned int claw::graphic::image::width |
( |
| ) |
const |
Gets image's width.
Definition at line 130 of file image.cpp.
The documentation for this class was generated from the following files: