#include <imagebuf.h>
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 Iterator & | operator= (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 |
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] = ...; } }
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.
OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::Iterator | ( | ImageBuf & | ib, | |
int | x, | |||
int | y | |||
) | [inline] |
Construct from an ImageBuf and a specific pixel index..
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.
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.
void OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator++ | ( | int | ) | [inline] |
Increment to the next pixel in the region.
void OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator++ | ( | ) | [inline] |
Increment to the next pixel in the region.
const Iterator& OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::operator= | ( | const Iterator< BUFT, USERT > & | i | ) | [inline] |
Assign one Iterator to another
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;
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.
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.
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.
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.
int OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::x | ( | ) | const [inline] |
Retrieve the current x location of the iterator.
int OpenImageIO::ImageBuf::Iterator< BUFT, USERT >::y | ( | ) | const [inline] |
Retrieve the current y location of the iterator.