OpenImageIO::ImageBuf::Iterator< BUFT, USERT > Class Template Reference

#include <imagebuf.h>

List of all members.

Public Member Functions

 Iterator (ImageBuf &ib)
 Iterator (ImageBuf &ib, int x, int y)
 Iterator (ImageBuf &ib, int xbegin, int ybegin, int xend, int yend)
 Iterator (const Iterator &i)
void pos (int x, int y)
void operator++ ()
void operator++ (int)
const Iteratoroperator= (const Iterator &i)
int x () const
int y () const
bool valid () const
bool valid (int x, int y) const
DataArrayProxy< BUFT, USERT > & operator* ()
USERT operator[] (int i) const
DataProxy< BUFT, USERT > operator[] (int i)
void * rawptr () const

Detailed Description

template<typename BUFT, typename USERT = float>
class OpenImageIO::ImageBuf::Iterator< BUFT, USERT >

Templated class for referring to an individual pixel in an ImageBuf, iterating over the pixels of an ImageBuf, or iterating over the pixels of a specified region of the ImageBuf [xbegin..xend) X [ybegin..yend). It is templated on BUFT, the type known to be in the internal representation of the ImageBuf, and USERT, the type that the user wants to retrieve or set the data (defaulting to float). the whole idea is to allow this:

   ImageBuf img (...);
   ImageBuf::Iterator<float> pixel (img, 0, 512, 0, 512);
   for (  ;  pixel.valid();  ++pixel) {
       for (int c = 0;  c < img.nchannels();  ++c) {
           float x = (*pixel)[c];
           (*pixel)[c] = ...;
       }
   }

Constructor & Destructor Documentation

template<typename BUFT , typename USERT = float>
OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::Iterator ( ImageBuf ib  )  [inline]

Construct from just an ImageBuf -- iterate over the whole region, starting with the upper left pixel of the region.

template<typename BUFT , typename USERT = float>
OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::Iterator ( ImageBuf ib,
int  x,
int  y 
) [inline]

Construct from an ImageBuf and a specific pixel index..

template<typename BUFT , typename USERT = float>
OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::Iterator ( ImageBuf ib,
int  xbegin,
int  ybegin,
int  xend,
int  yend 
) [inline]

Construct from an ImageBuf and designated region -- iterate over region, starting with the upper left pixel.


Member Function Documentation

template<typename BUFT , typename USERT = float>
DataArrayProxy<BUFT,USERT>& OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator* (  )  [inline]

Dereferencing the iterator gives us a proxy for the pixel, which we can index for reading or assignment.

template<typename BUFT , typename USERT = float>
void OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator++ ( int   )  [inline]

Increment to the next pixel in the region.

template<typename BUFT , typename USERT = float>
void OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator++ (  )  [inline]

Increment to the next pixel in the region.

template<typename BUFT , typename USERT = float>
const Iterator& OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator= ( const Iterator< BUFT, USERT > &  i  )  [inline]

Assign one Iterator to another

template<typename BUFT , typename USERT = float>
DataProxy<BUFT,USERT> OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator[] ( int  i  )  [inline]

Array referencing retrieve a proxy (which may be "assigned to") of i-th channel of the current pixel, so that this works: me[i] = val;

template<typename BUFT , typename USERT = float>
USERT OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator[] ( int  i  )  const [inline]

Array indexing retrieves the value of the i-th channel of the current pixel.

template<typename BUFT , typename USERT = float>
void OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::pos ( int  x,
int  y 
) [inline]

Explicitly point the iterator. This results in an invalid iterator if outside the previously-designated region.

template<typename BUFT , typename USERT = float>
bool OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::valid ( int  x,
int  y 
) const [inline]

Is the location (x,y) valid? Locations outside the designated region are invalid, as is an iterator that has completed iterating over the whole region.

template<typename BUFT , typename USERT = float>
bool OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::valid (  )  const [inline]

Is the current location valid? Locations outside the designated region are invalid, as is an iterator that has completed iterating over the whole region.

template<typename BUFT , typename USERT = float>
int OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::x (  )  const [inline]

Retrieve the current x location of the iterator.

template<typename BUFT , typename USERT = float>
int OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::y (  )  const [inline]

Retrieve the current y location of the iterator.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Tue Oct 27 06:30:41 2009 for OpenImageIO by  doxygen 1.6.1