FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
FotoSHOCKcore::TileIterator< PixelFormat > Class Template Reference

Iterator to traverse through the content of a Tile. More...

#include <Tile.hpp>

Public Types

typedef ValueTypeInfo
< PixelFormat >::Type 
format
 Format of pixels in the Tile. More...
 

Public Member Functions

 TileIterator (Tile< PixelFormat > *tile)
 A constructor. More...
 
 TileIterator (const TileIterator< PixelFormat > &other)
 A copy constructor. More...
 
virtual ~TileIterator ()
 A destructor.
 
TileIterator< PixelFormat > & operator= (const TileIterator< PixelFormat > &other)
 Assignment operator. More...
 
bool operator== (const TileIterator< PixelFormat > &other) const
 Equality operator. More...
 
bool operator!= (const TileIterator< PixelFormat > &other) const
 Inequality operator. More...
 
TileIterator< PixelFormat > & operator++ ()
 Move the iterator to the next pixel. More...
 
TileIterator< PixelFormat > & operator-- ()
 Move the iterator to the previous pixel. More...
 
TileIterator< PixelFormat > & moveTo (unsigned int x, unsigned int y)
 Move the iterator to a specified position. More...
 
formatoperator* ()
 Access pixel at the current iterator position. More...
 
const formatoperator* () const
 Access pixel at the current iterator position. More...
 
formatoperator() (unsigned int x, unsigned int y)
 Access pixel at the given position. More...
 
const formatoperator() (unsigned int x, unsigned int y) const
 Access pixel at the given position. More...
 
formatoperator[] (unsigned int n)
 Access a band of a pixel at the current iterator position. More...
 
const format operator[] (unsigned int n) const
 Access a band of a pixel at the current iterator position. More...
 
format getValue (unsigned int band) const
 Get the value of a band at the iterator's current position. More...
 
void setValue (unsigned int band, format value)
 Set the band value at the current iterator position. More...
 
const unsigned int getX () const
 Get the x coordinate of the current position. More...
 
const unsigned int getY () const
 Get the y coordinate of the current position. More...
 

Protected Member Functions

 TileIterator ()
 Default constructor. More...
 

Friends

class Tile< PixelFormat >
 
class ImageBufferIterator< PixelFormat >
 

Detailed Description

template<ValueType::Enum PixelFormat>
class FotoSHOCKcore::TileIterator< PixelFormat >

Iterator to traverse through the content of a Tile.

This iterator is used to access and traverse data in a Tile. It should never be constructed directly but rather it shold be obtained by a call to Tile::upperLeft(), Tile::lowerRight() or Tile::getIterator(unsigned int, unsigned int)

For performance considerations the iterator doesn't care about Tile or pixel bounds. That means that checking whether Tile/pixel bounds is up to the user.

Examples:
graph/example.cpp.

Member Typedef Documentation

template<ValueType::Enum PixelFormat>
typedef ValueTypeInfo<PixelFormat>::Type FotoSHOCKcore::TileIterator< PixelFormat >::format

Format of pixels in the Tile.

Defines the underlying C++ type used for the given ValueType.

Constructor & Destructor Documentation

template<ValueType::Enum PixelFormat>
FotoSHOCKcore::TileIterator< PixelFormat >::TileIterator ( Tile< PixelFormat > *  tile)

A constructor.

This constructor should NEVER be called directly. It is called from within Tile when a reference to iterator is requested.

Parameters
tilepointer to a Tile for which the iterator is used
template<ValueType::Enum PixelFormat>
FotoSHOCKcore::TileIterator< PixelFormat >::TileIterator ( const TileIterator< PixelFormat > &  other)

A copy constructor.

Performs a copy.

Parameters
otherthe TileIterator to copy
template<ValueType::Enum PixelFormat>
FotoSHOCKcore::TileIterator< PixelFormat >::TileIterator ( )
protected

Default constructor.

This constructor is used in ImageBufferIterator to create an array of TileIterators. It should not be used anywhere else.

Member Function Documentation

template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat >::format FotoSHOCKcore::TileIterator< PixelFormat >::getValue ( unsigned int  band) const

Get the value of a band at the iterator's current position.

Parameters
bandnumber of the band
Returns
value of band
template<ValueType::Enum PixelFormat>
const unsigned int FotoSHOCKcore::TileIterator< PixelFormat >::getX ( ) const

Get the x coordinate of the current position.

This function can be slow because it does division internally.

Returns
x coordinate
template<ValueType::Enum PixelFormat>
const unsigned int FotoSHOCKcore::TileIterator< PixelFormat >::getY ( ) const

Get the y coordinate of the current position.

This function can be slow because it does division internally.

Returns
y coordinate
template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat > & FotoSHOCKcore::TileIterator< PixelFormat >::moveTo ( unsigned int  x,
unsigned int  y 
)

Move the iterator to a specified position.

Parameters
xx coordinate
yy coordinate
Returns
reference to the iterator
template<ValueType::Enum PixelFormat>
bool FotoSHOCKcore::TileIterator< PixelFormat >::operator!= ( const TileIterator< PixelFormat > &  other) const

Inequality operator.

Check whether the position of two iterators is the same or not.

Returns
true if the iterators points to different positions in a Tile
template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat >::format * FotoSHOCKcore::TileIterator< PixelFormat >::operator() ( unsigned int  x,
unsigned int  y 
)

Access pixel at the given position.

Iterator is not moved. The coordinate numbering starts from 0. For performance considerations there is no check whether the position is valid.

Parameters
xx coordinate
yy coordinate
Returns
pointer which can be used as an array.
template<ValueType::Enum PixelFormat>
const TileIterator< PixelFormat >::format * FotoSHOCKcore::TileIterator< PixelFormat >::operator() ( unsigned int  x,
unsigned int  y 
) const

Access pixel at the given position.

Iterator is not moved. The coordinate numbering starts from 0. For performance considerations there is no check whether the position is valid.

Parameters
xx coordinate
yy coordinate
Returns
pointer which can be used as an array.
template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat >::format * FotoSHOCKcore::TileIterator< PixelFormat >::operator* ( )

Access pixel at the current iterator position.

Returns
pointer which can be used as an array to access all pixel channels.
template<ValueType::Enum PixelFormat>
const TileIterator< PixelFormat >::format * FotoSHOCKcore::TileIterator< PixelFormat >::operator* ( ) const

Access pixel at the current iterator position.

Returns
pointer which can be used as an array to access all pixel channels.
template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat > & FotoSHOCKcore::TileIterator< PixelFormat >::operator++ ( )

Move the iterator to the next pixel.

The order in which pixels are traversed is from the left to right, from top to bottom.

Returns
reference to the iterator
template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat > & FotoSHOCKcore::TileIterator< PixelFormat >::operator-- ( )

Move the iterator to the previous pixel.

The order in which pixels are traversed is from the right to left, from bottom to top.

Returns
reference to the iterator
template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat > & FotoSHOCKcore::TileIterator< PixelFormat >::operator= ( const TileIterator< PixelFormat > &  other)

Assignment operator.

Performs a copy of the data.

Parameters
otherthe TileIterator used as a source for the data
Returns
reference to the current ImageBuffer
template<ValueType::Enum PixelFormat>
bool FotoSHOCKcore::TileIterator< PixelFormat >::operator== ( const TileIterator< PixelFormat > &  other) const

Equality operator.

Check whether the position of two iterators is the same or not.

Returns
true if both iterators point to the same position, otherwise false is returned
template<ValueType::Enum PixelFormat>
TileIterator< PixelFormat >::format & FotoSHOCKcore::TileIterator< PixelFormat >::operator[] ( unsigned int  n)

Access a band of a pixel at the current iterator position.

Parameters
nthe band number. Numbering starts from 0
Returns
value of a band at the current iterator position
template<ValueType::Enum PixelFormat>
const TileIterator< PixelFormat >::format FotoSHOCKcore::TileIterator< PixelFormat >::operator[] ( unsigned int  n) const

Access a band of a pixel at the current iterator position.

Parameters
nthe band number. Numbering starts from 0
Returns
value of a band at the current iterator position
template<ValueType::Enum PixelFormat>
void FotoSHOCKcore::TileIterator< PixelFormat >::setValue ( unsigned int  band,
format  value 
)

Set the band value at the current iterator position.

Parameters
bandnumber of the band
valuenew value

The documentation for this class was generated from the following file: