osgEarth 2.1.1
|
Public Types | |
typedef osg::Vec4(* | ReaderFunc )(const PixelReader *ia, int s, int t, int r, int m) |
Public Member Functions | |
PixelReader (const osg::Image *image) | |
osg::Vec4 | operator() (int s, int t, int r=0, int m=0) const |
const unsigned char * | data (int s=0, int t=0, int r=0, int m=0) const |
Static Public Member Functions | |
static bool | supports (GLenum pixelFormat, GLenum dataType) |
static bool | supports (const osg::Image *image) |
Public Attributes | |
ReaderFunc | _reader |
const osg::Image * | _image |
unsigned | _colMult |
unsigned | _rowMult |
unsigned | _imageSize |
Reads color data out of an image, regardles of its internal pixel format.
Definition at line 202 of file ImageUtils.
typedef osg::Vec4(* osgEarth::ImageUtils::PixelReader::ReaderFunc)(const PixelReader *ia, int s, int t, int r, int m) |
Definition at line 227 of file ImageUtils.
ImageUtils::PixelReader::PixelReader | ( | const osg::Image * | image | ) |
Definition at line 941 of file ImageUtils.cpp.
: _image(image) { _colMult = _image->getPixelSizeInBits() / 8; _rowMult = _image->getRowSizeInBytes(); _imageSize = _image->getImageSizeInBytes(); GLenum dataType = _image->getDataType(); _reader = getReader( _image->getPixelFormat(), dataType ); if ( !_reader ) { OE_WARN << "[PixelReader] No reader found for pixel format " << std::hex << _image->getPixelFormat() << std::endl; _reader = &ColorReader<0,GLbyte>::read; } }
const unsigned char* osgEarth::ImageUtils::PixelReader::data | ( | int | s = 0 , |
int | t = 0 , |
||
int | r = 0 , |
||
int | m = 0 |
||
) | const [inline] |
Definition at line 221 of file ImageUtils.
{ return m == 0 ? _image->data() + s*_colMult + t*_rowMult + r*_imageSize : _image->getMipmapData(m) + s*_colMult + t*(_rowMult >> m) + r*(_imageSize>>m) ; }
osg::Vec4 osgEarth::ImageUtils::PixelReader::operator() | ( | int | s, |
int | t, | ||
int | r = 0 , |
||
int | m = 0 |
||
) | const [inline] |
Reads a color from the image
Definition at line 216 of file ImageUtils.
{ return (*_reader)(this, s, t, r, m); }
bool ImageUtils::PixelReader::supports | ( | GLenum | pixelFormat, |
GLenum | dataType | ||
) | [static] |
Whether PixelReader supports a given format/datatype combiniation.
Definition at line 957 of file ImageUtils.cpp.
{ return getReader(pixelFormat, dataType) != 0L; }
static bool osgEarth::ImageUtils::PixelReader::supports | ( | const osg::Image * | image | ) | [inline, static] |
Whether PixelReader can read from the specified image.
Definition at line 211 of file ImageUtils.
{ return image && supports(image->getPixelFormat(), image->getDataType() ); }
Definition at line 230 of file ImageUtils.
const osg::Image* osgEarth::ImageUtils::PixelReader::_image |
Definition at line 229 of file ImageUtils.
Definition at line 232 of file ImageUtils.
Definition at line 228 of file ImageUtils.
Definition at line 231 of file ImageUtils.