40 return super::operator[](i);
51 return super::operator[](i);
61template<
typename Image,
typename Pixel>
63 : m_owner(NULL), m_pos(0, 0)
75template<
typename Image,
typename Pixel>
77( image_type& owner,
unsigned int x,
unsigned int y )
78 : m_owner(&owner), m_pos(x, y)
88template<
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;
106template<
typename Image,
typename Pixel>
111 return !(*
this == that);
119template<
typename Image,
typename Pixel>
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;
135template<
typename Image,
typename Pixel>
149template<
typename Image,
typename Pixel>
154 return !(*
this > that);
163template<
typename Image,
typename Pixel>
168 return !(*
this < that);
176template<
typename Image,
typename Pixel>
186 unsigned int n_y = n / m_owner->width();
187 unsigned int n_x = n % m_owner->width();
201template<
typename Image,
typename Pixel>
211 unsigned int n_y = n / m_owner->width();
212 unsigned int n_x = n % m_owner->width();
229template<
typename Image,
typename Pixel>
243template<
typename Image,
typename Pixel>
258template<
typename ImageT,
typename PixelT>
273template<
typename Image,
typename Pixel>
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;
300template<
typename Image,
typename Pixel>
308 if ( m_pos.x == m_owner->width() )
321template<
typename Image,
typename Pixel>
334template<
typename Image,
typename Pixel>
343 m_pos.x = m_owner->width() - 1;
356template<
typename Image,
typename Pixel>
369template<
typename Image,
typename Pixel>
375 return (*m_owner)[m_pos.y][m_pos.x];
382template<
typename Image,
typename Pixel>
388 return &(*m_owner)[m_pos.y][m_pos.x];
396template<
typename Image,
typename Pixel>
407template<
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();
Some assert macros to strengthen you code.
#define CLAW_PRECOND(b)
Abort the program if a precondition is not true.
#define CLAW_POSTCOND(b)
Abort the program if a postcondition is not true.
Base class for iterators on an image.
self_type & operator+=(int n)
Move the iterator.
pixel_type * pointer
The type of the pointers to the values accesssed by the iterator.
self_type & operator-=(int n)
Move the iterator.
self_type & operator++()
Preincrement.
pointer operator->() const
Get a pointer on the pointed pixel.
self_type operator-(int n) const
Get an iterator at a specific distance of the current iterator.
pixel_type & reference
The type of the references to the values accesssed by the iterator.
reference operator*() const
Get a reference on the pointed pixel.
ptrdiff_t difference_type
The type of the distance between two iterators.
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.
base_iterator()
Constructor.
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.
scanline & operator[](unsigned int i)
Gets a line of the image.
value_type x
X-coordinate.