30 #ifndef __CLAW_IMAGE_HPP__
31 #define __CLAW_IMAGE_HPP__
60 private std::vector<pixel_type>
66 typedef std::vector<pixel_type>
super;
90 const_iterator
begin()
const;
91 const_iterator
end()
const;
94 inline const_reference
operator[](
unsigned int i)
const;
96 size_type
size()
const;
105 template<
typename Image,
typename Pixel>
107 public std::iterator<std::random_access_iterator_tag, Pixel>
111 typedef Image image_type;
114 typedef Pixel pixel_type;
140 unsigned int y = 0 );
142 inline bool operator==(
const self_type& that )
const;
143 inline bool operator!=(
const self_type& that )
const;
144 inline bool operator<(
const self_type& that )
const;
145 inline bool operator>(
const self_type& that )
const;
146 inline bool operator<=(
const self_type& that )
const;
147 inline bool operator>=(
const self_type& that )
const;
152 inline self_type
operator+(
int n )
const;
153 inline self_type
operator-(
int n )
const;
161 template<
typename ImageT,
typename PixelT>
162 friend inline self_type
operator+(
int n,
const self_type&
self );
164 inline difference_type
operator-(
const self_type& that )
const;
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;
220 const_iterator
begin()
const;
221 const_iterator
end()
const;
233 void set_size(
unsigned int w,
unsigned int h );
235 void load( std::istream& f );
239 std::vector<scanline> m_data;
254 #endif // __CLAW_IMAGE_HPP__
unsigned int height() const
Gets image's height.
base_iterator()
Constructor.
super::const_reference const_reference
Const reference to a pixel.
std::random_access_iterator_tag iterator_category
The type of this category.
void partial_copy(const image &that, const math::coordinate_2d< int > &pos)
Copy an image on the current image.
ptrdiff_t difference_type
The type of the distance between two iterators.
super::const_iterator const_iterator
Const iterator in the line.
rgba_pixel pixel_type
The type representing the colors of the pixels in the image.
reference operator[](unsigned int i)
Get a pixel from the line.
super::value_type value_type
The type of the pixels.
self_type & operator+=(int n)
Move the iterator.
iterator end()
Get an iterator pointing just past the last pixel.
bool operator<(const self_type &that) const
Tell if the current iterator is before an other.
base_iterator< image, pixel_type > iterator
The type of the iterator on the pixels of the 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.
self_type operator+(int n) const
Get an iterator at a specific distance of the current iterator.
Base class for iterators on an image.
reference operator*() const
Get a reference on the pointed pixel.
iterator end()
Get en iterator past the last pixel.
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.
void load(std::istream &f)
Read the image from a stream.
Some mathematical structures and functions.
pixel_type * pointer
The type of the pointers to the values accesssed by the iterator.
pointer operator->() const
Get a pointer on the pointed pixel.
image()
Constructor. Creates an image without datas.
super::iterator iterator
Iterator in the line.
pixel_type & reference
The type of the references to the values accesssed by the iterator.
reference operator[](int n) const
Get a pixel, using the iterator like an array.
std::vector< pixel_type > super
The type of the parent class.
scanline & operator[](unsigned int i)
Gets a line of the image.
bool operator>(const self_type &that) const
Tell if the current iterator is after an other.
bool operator>=(const self_type &that) const
Tell if the current iterator is after an other, or on the same address.
void merge(const image &that)
Merge an image on the current image.
pixel_type value_type
The type of the values accessed by the iterator.
iterator begin()
Get an iterator on the first pixel.
base_iterator< const image, const pixel_type > const_iterator
The type of the iterator to access constant pixels.
iterator begin()
Get an iterator pointing on the first pixel.
super::reference reference
Reference to a pixel..
bool operator==(const self_type &that) const
Tell if two iterator point to the same address.
Representation of a pixel in image processing.
A class to deal with images.
self_type & operator++()
Preincrement.
bool operator!=(const self_type &that) const
Tell if two iterator points to different addresses.
self_type & operator--()
Predecrement.
A class representing a rectangle by his x,y coordinates, width and height.
This is the main namespace.
self_type & operator-=(int n)
Move the iterator.
void set_size(unsigned int w, unsigned int h)
Set a new size to the image.
size_type size() const
Get the length of the line.
Inline methods for the claw::graphic::image class.