osgEarth 2.1.1
Public Member Functions

osgEarth::ImageUtils::PixelVisitor< T > Struct Template Reference

List of all members.

Public Member Functions

void accept (osg::Image *image)
void accept (const osg::Image *src, osg::Image *dest)

Detailed Description

template<typename T>
struct osgEarth::ImageUtils::PixelVisitor< T >

Functor that visits every pixel in an image

Definition at line 276 of file ImageUtils.


Member Function Documentation

template<typename T>
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);
                        }
                    }
                }
            }          

Here is the caller graph for this function:

template<typename T>
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);
                        }
                    }
                }
            }

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