osgEarth 2.1.1
|
Public Member Functions | |
void | accept (osg::Image *image) |
void | accept (const osg::Image *src, osg::Image *dest) |
Functor that visits every pixel in an image
Definition at line 276 of file ImageUtils.
void osgEarth::ImageUtils::PixelVisitor< T >::accept | ( | osg::Image * | image | ) | [inline] |
Traverse an image, and call this method on the superclass:
bool operator(const osg::Vec4& pixel);
If that method returns true, write the value back at the same location.
Definition at line 285 of file ImageUtils.
{ PixelReader _reader( image ); PixelWriter _writer( image ); for( int r=0; r<image->r(); ++r ) { for( int t=0; t<image->t(); ++t ) { for( int s=0; s<image->s(); ++s ) { osg::Vec4f pixel = _reader(s,t,r); if ( (*this)(pixel) ) _writer(pixel,s,t,r); } } } }
void osgEarth::ImageUtils::PixelVisitor< T >::accept | ( | const osg::Image * | src, |
osg::Image * | dest | ||
) | [inline] |
Traverse an image, and call this method on the superclass:
bool operator(const osg::Vec4& srcPixel, osg::Vec4& destPixel);
If that method returns true, write destPixel back at the same location in the destination image.
Definition at line 307 of file ImageUtils.
{ PixelReader _readerSrc( src ); PixelReader _readerDest( dest ); PixelWriter _writerDest( dest ); for( int r=0; r<src->r(); ++r ) { for( int t=0; t<src->t(); ++t ) { for( int s=0; s<src->s(); ++s ) { const osg::Vec4f pixelSrc = _readerSrc(s,t,r); osg::Vec4f pixelDest = _readerDest(s,t,r); if ( (*this)(pixelSrc, pixelDest) ) _writerDest(pixelDest,s,t,r); } } } }