30#ifndef __CLAW_IMAGE_HPP__
31#define __CLAW_IMAGE_HPP__
61 class scanline :
private std::vector<pixel_type>
67 typedef std::vector<pixel_type>
super;
106 template <
typename Image,
typename Pixel>
111 typedef Image image_type;
114 typedef Pixel pixel_type;
161 template <
typename ImageT,
typename PixelT>
162 friend inline self_type
operator+(
int n,
const self_type& self);
177 bool is_final()
const;
207 image(
unsigned int w,
unsigned int h);
208 image(std::istream& f);
212 unsigned int width()
const;
213 unsigned int height()
const;
232 void set_size(
unsigned int w,
unsigned int h);
234 void load(std::istream& f);
238 std::vector<scanline> m_data;
Base class for iterators on an image.
self_type & operator+=(int n)
Move the iterator.
bool operator<=(const self_type &that) const
Tell if the current iterator is before an other, or on the same address.
self_type operator+(int n) const
Get an iterator at a specific distance of the current iterator.
bool operator>(const self_type &that) const
Tell if the current iterator is after an other.
self_type operator++(int)
Postincrement.
self_type & operator-=(int n)
Move the iterator.
std::random_access_iterator_tag iterator_category
self_type & operator++()
Preincrement.
pointer operator->() const
Get a pointer on the pointed pixel.
base_iterator(image_type &owner, unsigned int x=0, unsigned int y=0)
Constructor, from an image.
self_type operator-(int n) const
Get an iterator at a specific distance of the current iterator.
bool operator==(const self_type &that) const
Tell if two iterator point to the same address.
reference operator*() const
Get a reference on the pointed pixel.
self_type operator--(int)
Postdecrement.
bool operator<(const self_type &that) const
Tell if the current iterator is before an other.
ptrdiff_t difference_type
bool operator!=(const self_type &that) const
Tell if two iterator points to different addresses.
friend self_type operator+(int n, const self_type &self)
Get an iterator at a specific distance of the current iterator.
reference operator[](int n) const
Get a pixel, using the iterator like an array.
self_type & operator--()
Predecrement.
difference_type operator-(const self_type &that) const
Get the distance between two iterators.
bool operator>=(const self_type &that) const
Tell if the current iterator is after an other, or on the same address.
base_iterator()
Constructor.
super::value_type value_type
The type of the pixels.
super::size_type size_type
An unsigned integral type.
iterator begin()
Get an iterator on the first pixel.
iterator end()
Get en iterator past the last pixel.
super::reference reference
Reference to a pixel..
reference operator[](unsigned int i)
Get a pixel from the line.
super::const_reference const_reference
Const reference to a pixel.
super::iterator iterator
Iterator in the line.
std::vector< pixel_type > super
The type of the parent class.
super::const_iterator const_iterator
Const iterator in the line.
size_type size() const
Get the length of the line.
A class to deal with images.
void flip()
Set the image upside down.
void partial_copy(const image &that, const math::coordinate_2d< int > &pos)
Copy an image on the current image.
unsigned int height() const
Gets image's height.
rgba_pixel pixel_type
The type representing the colors of the pixels in the image.
scanline & operator[](unsigned int i)
Gets a line of the image.
void set_size(unsigned int w, unsigned int h)
Set a new size to the image.
unsigned int width() const
Gets image's width.
void merge(const image &that)
Merge an image on the current image.
void fill(const math::rectangle< int > r, const pixel_type &c)
Fill an area of the image with a given color.
iterator end()
Get an iterator pointing just past the last pixel.
void swap(image &that)
Swap the content of two images.
image()
Constructor. Creates an image without datas.
void load(std::istream &f)
Read the image from a stream.
base_iterator< const image, const pixel_type > const_iterator
The type of the iterator to access constant pixels.
base_iterator< image, pixel_type > iterator
The type of the iterator on the pixels of the image.
iterator begin()
Get an iterator pointing on the first pixel.
Coordinates in a two dimensional space.
A class representing a rectangle by his x,y coordinates, width and height.
Inline methods for the claw::graphic::image class.
Some mathematical structures and functions.
Everything about image structures and processing.
This is the main namespace.
Representation of a pixel in image processing.