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

Iterator for linear access to the ImageBuffer content. More...

#include <ImageBuffer.hpp>

Public Types

typedef ValueTypeInfo
< PixelFormat >::Type 
format
 

Public Member Functions

 ImageBufferIterator (ImageBuffer< PixelFormat > *buffer)
 A constructor. More...
 
 ImageBufferIterator (const ImageBufferIterator< PixelFormat > &other)
 A copy constructor. More...
 
 ~ImageBufferIterator ()
 A destructor.
 
ImageBufferIterator
< PixelFormat > & 
operator= (const ImageBufferIterator< PixelFormat > &other)
 An assignment operator. More...
 
bool operator== (const ImageBufferIterator< PixelFormat > &other) const
 Equality operator. More...
 
bool operator!= (const ImageBufferIterator< PixelFormat > &other) const
 Inequality operator. More...
 
ImageBufferIterator
< PixelFormat > & 
operator++ ()
 Move the iterator to the next pixel. More...
 
ImageBufferIterator
< PixelFormat > & 
operator-- ()
 Move the iterator to the previous pixel. More...
 
ImageBufferIterator
< PixelFormat > & 
moveTo (unsigned int x, unsigned int y)
 Move the iterator to a specified position int the image. More...
 
format * operator* ()
 Access pixel at the current iterator position. More...
 
const format * operator* () const
 Access pixel at the current iterator position. More...
 
format * operator() (unsigned int x, unsigned int y)
 Access pixel at the given position in the image. More...
 
const format * operator() (unsigned int x, unsigned int y) const
 Access pixel at the given position in the image. More...
 
format & operator[] (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...
 

Detailed Description

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

Iterator for linear access to the ImageBuffer content.

This iterator is simillar to the TileIterator.

ImageBufferIterator accesses ImageBuffer linearly. That means the image is accessed line by line.

Examples:
graph/example.cpp.

Constructor & Destructor Documentation

template<ValueType::Enum PixelFormat>
FotoSHOCKcore::ImageBufferIterator< PixelFormat >::ImageBufferIterator ( ImageBuffer< PixelFormat > *  buffer)

A constructor.

All iterators are allocated in advance. This takes more memory but it allows faster access

Parameters
buffer
template<ValueType::Enum PixelFormat>
FotoSHOCKcore::ImageBufferIterator< PixelFormat >::ImageBufferIterator ( const ImageBufferIterator< PixelFormat > &  other)

A copy constructor.

Provides a deep copy of iterator data.

Member Function Documentation

template<ValueType::Enum PixelFormat>
ImageBufferIterator< PixelFormat >::format FotoSHOCKcore::ImageBufferIterator< 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::ImageBufferIterator< 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::ImageBufferIterator< 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>
ImageBufferIterator< PixelFormat > & FotoSHOCKcore::ImageBufferIterator< PixelFormat >::moveTo ( unsigned int  x,
unsigned int  y 
)

Move the iterator to a specified position int the image.

Parameters
xx coordinate
yy coordinate
Returns
reference to the iterator
template<ValueType::Enum PixelFormat>
bool FotoSHOCKcore::ImageBufferIterator< PixelFormat >::operator!= ( const ImageBufferIterator< 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>
ImageBufferIterator< PixelFormat >::format * FotoSHOCKcore::ImageBufferIterator< PixelFormat >::operator() ( unsigned int  x,
unsigned int  y 
)

Access pixel at the given position in the image.

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 to access pixel channels
template<ValueType::Enum PixelFormat>
const ImageBufferIterator< PixelFormat >::format * FotoSHOCKcore::ImageBufferIterator< PixelFormat >::operator() ( unsigned int  x,
unsigned int  y 
) const

Access pixel at the given position in the image.

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 to access pixel channels
template<ValueType::Enum PixelFormat>
ImageBufferIterator< PixelFormat >::format * FotoSHOCKcore::ImageBufferIterator< 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 ImageBufferIterator< PixelFormat >::format * FotoSHOCKcore::ImageBufferIterator< 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>
ImageBufferIterator< PixelFormat > & FotoSHOCKcore::ImageBufferIterator< 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>
ImageBufferIterator< PixelFormat > & FotoSHOCKcore::ImageBufferIterator< 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.

template<ValueType::Enum PixelFormat>
ImageBufferIterator< PixelFormat > & FotoSHOCKcore::ImageBufferIterator< PixelFormat >::operator= ( const ImageBufferIterator< PixelFormat > &  other)

An assignment operator.

Provides a deep copy of iterator data.

template<ValueType::Enum PixelFormat>
bool FotoSHOCKcore::ImageBufferIterator< PixelFormat >::operator== ( const ImageBufferIterator< 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>
ImageBufferIterator< PixelFormat >::format & FotoSHOCKcore::ImageBufferIterator< 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 ImageBufferIterator< PixelFormat >::format FotoSHOCKcore::ImageBufferIterator< 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::ImageBufferIterator< 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: