osgEarth 2.1.1
|
Public Types | |
typedef void(* | WriterFunc )(const PixelWriter *iw, const osg::Vec4 &c, int s, int t, int r, int m) |
Public Member Functions | |
PixelWriter (osg::Image *image) | |
void | operator() (const osg::Vec4 &c, int s, int t, int r=0, int m=0) |
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 | |
osg::Image * | _image |
unsigned | _colMult |
unsigned | _rowMult |
unsigned | _imageSize |
WriterFunc | _writer |
Writes color data to an image, regardles of its internal pixel format.
Definition at line 238 of file ImageUtils.
typedef void(* osgEarth::ImageUtils::PixelWriter::WriterFunc)(const PixelWriter *iw, const osg::Vec4 &c, int s, int t, int r, int m) |
Definition at line 268 of file ImageUtils.
ImageUtils::PixelWriter::PixelWriter | ( | osg::Image * | image | ) |
Definition at line 1029 of file ImageUtils.cpp.
: _image(image) { _colMult = _image->getPixelSizeInBits() / 8; _rowMult = _image->getRowSizeInBytes(); _imageSize = _image->getImageSizeInBytes(); GLenum dataType = _image->getDataType(); _writer = getWriter( _image->getPixelFormat(), dataType ); if ( !_writer ) { OE_WARN << "[PixelWriter] No writer found for pixel format " << std::hex << _image->getPixelFormat() << std::endl; _writer = &ColorWriter<0, GLbyte>::write; } }
unsigned char* osgEarth::ImageUtils::PixelWriter::data | ( | int | s = 0 , |
int | t = 0 , |
||
int | r = 0 , |
||
int | m = 0 |
||
) | const [inline] |
Definition at line 262 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); }
void osgEarth::ImageUtils::PixelWriter::operator() | ( | const osg::Vec4 & | c, |
int | s, | ||
int | t, | ||
int | r = 0 , |
||
int | m = 0 |
||
) | [inline] |
Writes a color to a pixel.
Definition at line 252 of file ImageUtils.
{
(*_writer)(this, c, s, t, r, m );
}
bool ImageUtils::PixelWriter::supports | ( | GLenum | pixelFormat, |
GLenum | dataType | ||
) | [static] |
Whether PixelWriter can write to an image with the given format/datatype combo.
Definition at line 1045 of file ImageUtils.cpp.
{ return getWriter(pixelFormat, dataType) != 0L; }
static bool osgEarth::ImageUtils::PixelWriter::supports | ( | const osg::Image * | image | ) | [inline, static] |
Whether PixelWriter can write to non-const version of an image.
Definition at line 247 of file ImageUtils.
{ return image && supports(image->getPixelFormat(), image->getDataType() ); }
Definition at line 258 of file ImageUtils.
osg::Image* osgEarth::ImageUtils::PixelWriter::_image |
Definition at line 257 of file ImageUtils.
Definition at line 260 of file ImageUtils.
Definition at line 259 of file ImageUtils.
Definition at line 269 of file ImageUtils.