40 return super::operator[](i);
51 return super::operator[](i);
61 template<
typename Image,
typename Pixel>
63 : m_owner(NULL), m_pos(0, 0)
75 template<
typename Image,
typename Pixel>
77 ( image_type& owner,
unsigned int x,
unsigned int y )
78 : m_owner(&owner), m_pos(x, y)
88 template<
typename Image,
typename Pixel>
93 if ( is_final() && that.is_final() )
95 else if ( m_owner == that.m_owner )
96 return m_pos == that.m_pos;
106 template<
typename Image,
typename Pixel>
108 claw::graphic::image::base_iterator<Image, Pixel>::operator!=
111 return !(*
this == that);
119 template<
typename Image,
typename Pixel>
121 claw::graphic::image::base_iterator<Image, Pixel>::operator<
124 if ( this->m_pos.y == that.m_pos.y)
125 return this->m_pos.
x < that.m_pos.x;
127 return this->m_pos.y < that.m_pos.y;
135 template<
typename Image,
typename Pixel>
137 claw::graphic::image::base_iterator<Image, Pixel>::operator>
149 template<
typename Image,
typename Pixel>
151 claw::graphic::image::base_iterator<Image, Pixel>::operator<=
154 return !(*
this > that);
163 template<
typename Image,
typename Pixel>
165 claw::graphic::image::base_iterator<Image, Pixel>::operator>=
168 return !(*
this < that);
176 template<
typename Image,
typename Pixel>
186 unsigned int n_y = n / m_owner->width();
187 unsigned int n_x = n % m_owner->width();
201 template<
typename Image,
typename Pixel>
211 unsigned int n_y = n / m_owner->width();
212 unsigned int n_x = n % m_owner->width();
229 template<
typename Image,
typename Pixel>
243 template<
typename Image,
typename Pixel>
258 template<
typename ImageT,
typename PixelT>
273 template<
typename Image,
typename Pixel>
276 claw::graphic::image::base_iterator<Image, Pixel>::operator-
279 CLAW_PRECOND( is_final() || that.is_final() || (m_owner == that.m_owner) );
281 if ( that.is_final() )
286 return -(m_owner->height() - m_pos.y) * m_owner->width() - m_pos.x;
288 else if ( is_final() )
289 return (that.m_owner->height() - that.m_pos.y) * that.m_owner->width()
292 return m_pos.y * m_owner->width() + m_pos.x
293 - that.m_pos.y * that.m_owner->width() + that.m_pos.x;
300 template<
typename Image,
typename Pixel>
308 if ( m_pos.x == m_owner->width() )
321 template<
typename Image,
typename Pixel>
334 template<
typename Image,
typename Pixel>
343 m_pos.x = m_owner->width() - 1;
356 template<
typename Image,
typename Pixel>
369 template<
typename Image,
typename Pixel>
375 return (*m_owner)[m_pos.y][m_pos.x];
382 template<
typename Image,
typename Pixel>
388 return &(*m_owner)[m_pos.y][m_pos.x];
396 template<
typename Image,
typename Pixel>
407 template<
typename Image,
typename Pixel>
413 else if ( m_pos.y >= m_owner->height() )
415 else if ( m_pos.y == m_owner->height() - 1 )
416 return m_pos.x >= m_owner->width();
base_iterator()
Constructor.
super::const_reference const_reference
Const reference to a pixel.
ptrdiff_t difference_type
The type of the distance between two iterators.
reference operator[](unsigned int i)
Get a pixel from the line.
self_type & operator+=(int n)
Move the iterator.
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.
self_type operator-(int n) const
Get an iterator at a specific distance of the current iterator.
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.
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.
scanline & operator[](unsigned int i)
Gets a line of the image.
#define CLAW_POSTCOND(b)
Abort the program if a postcondition is not true.
super::reference reference
Reference to a pixel..
Some assert macros to strengthen you code.
self_type & operator++()
Preincrement.
self_type & operator--()
Predecrement.
self_type & operator-=(int n)
Move the iterator.
#define CLAW_PRECOND(b)
Abort the program if a precondition is not true.
value_type x
X-coordinate.