xoreos
0.0.5
|
A generic interface for image decoders. More...
#include <decoder.h>
Classes | |
struct | MipMap |
A mip map. More... | |
Public Member Functions | |
ImageDecoder () | |
ImageDecoder (const ImageDecoder &image) | |
virtual | ~ImageDecoder () |
ImageDecoder & | operator= (const ImageDecoder &image) |
bool | isCompressed () const |
Is the image data compressed? More... | |
bool | hasAlpha () const |
Does the image data have alpha? . More... | |
PixelFormat | getFormat () const |
Return the image data's general format. More... | |
PixelFormatRaw | getFormatRaw () const |
Return the image data's raw format. More... | |
PixelDataType | getDataType () const |
Return the image data pixel's type. More... | |
size_t | getMipMapCount () const |
Return the number of mip maps contained in the image. More... | |
size_t | getLayerCount () const |
Return the number of layers contained in the image. More... | |
bool | isCubeMap () const |
Is this image a cube map? More... | |
const MipMap & | getMipMap (size_t mipMap, size_t layer=0) const |
Return a mip map. More... | |
void | decompress () |
Manually decompress the texture image data. More... | |
const TXI & | getTXI () const |
Return the texture information TXI, which may be embedded in the image. More... | |
bool | dumpTGA (const Common::UString &fileName) const |
Dump the image into a TGA. More... | |
Protected Types | |
typedef Common::PtrVector< MipMap > | MipMaps |
Static Protected Member Functions | |
static void | decompress (MipMap &out, const MipMap &in, PixelFormatRaw format) |
Protected Attributes | |
bool | _compressed |
bool | _hasAlpha |
PixelFormat | _format |
PixelFormatRaw | _formatRaw |
PixelDataType | _dataType |
size_t | _layerCount |
Number of layers in this image. More... | |
bool | _isCubeMap |
Is this image a cube map? A cube map always needs to have 6 layers! More... | |
MipMaps | _mipMaps |
TXI | _txi |
|
protected |
Graphics::ImageDecoder::ImageDecoder | ( | ) |
Definition at line 129 of file decoder.cpp.
Graphics::ImageDecoder::ImageDecoder | ( | const ImageDecoder & | image | ) |
Definition at line 135 of file decoder.cpp.
|
virtual |
Definition at line 139 of file decoder.cpp.
void Graphics::ImageDecoder::decompress | ( | ) |
Manually decompress the texture image data.
Definition at line 242 of file decoder.cpp.
References _compressed, _dataType, _format, _formatRaw, _mipMaps, Graphics::kPixelDataType8, Graphics::kPixelFormatRGBA, Graphics::kPixelFormatRGBA8, and Graphics::ImageDecoder::MipMap::swap().
Referenced by Graphics::Aurora::ModelNode_NWN2::createTint(), dumpTGA(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesAlpha(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesHair(), Graphics::TPC::fixupCubeMap(), and Graphics::Aurora::Texture::loadImage().
|
staticprotected |
Definition at line 215 of file decoder.cpp.
References Graphics::ImageDecoder::MipMap::data, Graphics::decompressDXT1(), Graphics::decompressDXT3(), Graphics::decompressDXT5(), Common::ScopedPtrBase< T, Deallocator >::get(), Graphics::hasValidDimensions(), Graphics::ImageDecoder::MipMap::height, Graphics::kPixelFormatDXT1, Graphics::kPixelFormatDXT3, Graphics::kPixelFormatDXT5, Common::ScopedPtrBase< T, Deallocator >::reset(), Graphics::ImageDecoder::MipMap::size, and Graphics::ImageDecoder::MipMap::width.
bool Graphics::ImageDecoder::dumpTGA | ( | const Common::UString & | fileName | ) | const |
Dump the image into a TGA.
Definition at line 260 of file decoder.cpp.
References _compressed, _mipMaps, decompress(), and Graphics::dumpTGA().
PixelDataType Graphics::ImageDecoder::getDataType | ( | ) | const |
Return the image data pixel's type.
Definition at line 184 of file decoder.cpp.
References _dataType.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner().
PixelFormat Graphics::ImageDecoder::getFormat | ( | ) | const |
Return the image data's general format.
Definition at line 176 of file decoder.cpp.
References _format.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner(), and Graphics::dumpTGA().
PixelFormatRaw Graphics::ImageDecoder::getFormatRaw | ( | ) | const |
Return the image data's raw format.
Definition at line 180 of file decoder.cpp.
References _formatRaw.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesAlpha(), and Graphics::Aurora::ModelNode_DragonAge::fixTexturesHair().
size_t Graphics::ImageDecoder::getLayerCount | ( | ) | const |
Return the number of layers contained in the image.
Definition at line 194 of file decoder.cpp.
References _layerCount.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner(), Graphics::dumpTGA(), and Graphics::TPC::fixupCubeMap().
const ImageDecoder::MipMap & Graphics::ImageDecoder::getMipMap | ( | size_t | mipMap, |
size_t | layer = 0 |
||
) | const |
Return a mip map.
Definition at line 204 of file decoder.cpp.
References _layerCount, _mipMaps, and getMipMapCount().
Referenced by Graphics::Aurora::ModelNode_NWN2::createTint(), Graphics::CubeMapCombiner::CubeMapCombiner(), Graphics::dumpTGA(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesAlpha(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesHair(), and Graphics::Surface::getMipMap().
size_t Graphics::ImageDecoder::getMipMapCount | ( | ) | const |
Return the number of mip maps contained in the image.
Definition at line 188 of file decoder.cpp.
References _layerCount, and _mipMaps.
Referenced by Graphics::Aurora::Texture::create(), Graphics::CubeMapCombiner::CubeMapCombiner(), Graphics::dumpTGA(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesAlpha(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesHair(), Graphics::TPC::fixupCubeMap(), getMipMap(), and Graphics::Aurora::Texture::loadImage().
const TXI & Graphics::ImageDecoder::getTXI | ( | ) | const |
Return the texture information TXI, which may be embedded in the image.
Definition at line 164 of file decoder.cpp.
References _txi.
bool Graphics::ImageDecoder::hasAlpha | ( | ) | const |
Does the image data have alpha? .
Definition at line 172 of file decoder.cpp.
References _hasAlpha.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner().
bool Graphics::ImageDecoder::isCompressed | ( | ) | const |
Is the image data compressed?
Definition at line 168 of file decoder.cpp.
References _compressed.
Referenced by Graphics::Aurora::ModelNode_NWN2::createTint(), Graphics::CubeMapCombiner::CubeMapCombiner(), Graphics::Aurora::ModelNode_DragonAge::fixTexturesAlpha(), and Graphics::Aurora::ModelNode_DragonAge::fixTexturesHair().
bool Graphics::ImageDecoder::isCubeMap | ( | ) | const |
Is this image a cube map?
Definition at line 198 of file decoder.cpp.
References _isCubeMap, and _layerCount.
Referenced by Graphics::Aurora::ModelNode_Witcher::buildMaterial(), Graphics::Aurora::ModelNode::buildMaterial(), and Graphics::TPC::fixupCubeMap().
ImageDecoder & Graphics::ImageDecoder::operator= | ( | const ImageDecoder & | image | ) |
Definition at line 142 of file decoder.cpp.
References _compressed, _dataType, _format, _formatRaw, _hasAlpha, _isCubeMap, _layerCount, _mipMaps, _txi, and Common::PtrVector< T, Deallocator >::clear().
|
protected |
Definition at line 119 of file decoder.h.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner(), decompress(), Graphics::DDS::detectFormat(), dumpTGA(), isCompressed(), operator=(), Graphics::DDS::readBioWareHeader(), Graphics::TPC::readHeader(), Graphics::TXB::readHeader(), Graphics::SBM::SBM(), Graphics::Surface::Surface(), Graphics::TGA::TGA(), and Graphics::WinIconImage::WinIconImage().
|
protected |
Definition at line 124 of file decoder.h.
Referenced by Graphics::CBGT::createImage(), Graphics::CubeMapCombiner::CubeMapCombiner(), decompress(), Graphics::DDS::detectFormat(), Graphics::NCGR::draw(), getDataType(), operator=(), Graphics::DDS::readBioWareHeader(), Graphics::TPC::readHeader(), Graphics::XEOSITEX::readHeader(), Graphics::TXB::readHeader(), Graphics::TGA::readHeader(), Graphics::NBFS::readImage(), Graphics::SBM::SBM(), Graphics::Surface::Surface(), and Graphics::WinIconImage::WinIconImage().
|
protected |
Definition at line 122 of file decoder.h.
Referenced by Graphics::CBGT::createImage(), Graphics::CubeMapCombiner::CubeMapCombiner(), decompress(), Graphics::DDS::detectFormat(), Graphics::NCGR::draw(), getFormat(), operator=(), Graphics::DDS::readBioWareHeader(), Graphics::WinIconImage::readData(), Graphics::TGA::readData(), Graphics::TPC::readHeader(), Graphics::XEOSITEX::readHeader(), Graphics::TXB::readHeader(), Graphics::TGA::readHeader(), Graphics::NBFS::readImage(), Graphics::SBM::SBM(), and Graphics::Surface::Surface().
|
protected |
Definition at line 123 of file decoder.h.
Referenced by Graphics::CBGT::createImage(), Graphics::CubeMapCombiner::CubeMapCombiner(), decompress(), Graphics::DDS::detectFormat(), Graphics::NCGR::draw(), Graphics::TPC::fixupCubeMap(), getFormatRaw(), operator=(), Graphics::DDS::readBioWareHeader(), Graphics::WinIconImage::readData(), Graphics::TPC::readHeader(), Graphics::XEOSITEX::readHeader(), Graphics::TXB::readHeader(), Graphics::TGA::readHeader(), Graphics::NBFS::readImage(), Graphics::DDS::readStandardHeader(), Graphics::SBM::SBM(), Graphics::DDS::setSize(), and Graphics::Surface::Surface().
|
protected |
Definition at line 120 of file decoder.h.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner(), Graphics::DDS::detectFormat(), hasAlpha(), operator=(), Graphics::DDS::readBioWareHeader(), Graphics::TPC::readHeader(), Graphics::XEOSITEX::readHeader(), Graphics::TXB::readHeader(), Graphics::TGA::readHeader(), Graphics::SBM::SBM(), Graphics::Surface::Surface(), and Graphics::WinIconImage::WinIconImage().
|
protected |
Is this image a cube map? A cube map always needs to have 6 layers!
Definition at line 129 of file decoder.h.
Referenced by Graphics::TPC::checkCubeMap(), Graphics::CubeMapCombiner::CubeMapCombiner(), isCubeMap(), operator=(), and Graphics::TGA::TGA().
|
protected |
Number of layers in this image.
For layered 3D images and cubemaps.
Definition at line 127 of file decoder.h.
Referenced by Graphics::TPC::checkCubeMap(), Graphics::CubeMapCombiner::CubeMapCombiner(), getLayerCount(), getMipMap(), getMipMapCount(), isCubeMap(), operator=(), Graphics::TGA::readData(), Graphics::TPC::readHeader(), Graphics::TGA::readHeader(), and Graphics::TGA::TGA().
|
protected |
Definition at line 131 of file decoder.h.
Referenced by Graphics::CBGT::createImage(), Graphics::CubeMapCombiner::CubeMapCombiner(), decompress(), Graphics::NCGR::draw(), Graphics::CBGT::drawImage(), dumpTGA(), Graphics::Surface::fill(), Graphics::TPC::fixupCubeMap(), Graphics::Surface::getData(), Graphics::Surface::getHeight(), Graphics::Surface::getMipMap(), getMipMap(), getMipMapCount(), Graphics::Surface::getWidth(), operator=(), Graphics::DDS::readBioWareHeader(), Graphics::TPC::readData(), Graphics::TXB::readData(), Graphics::SBM::readData(), Graphics::WinIconImage::readData(), Graphics::DDS::readData(), Graphics::TGA::readData(), Graphics::TPC::readHeader(), Graphics::XEOSITEX::readHeader(), Graphics::TXB::readHeader(), Graphics::TGA::readHeader(), Graphics::NBFS::readImage(), Graphics::XEOSITEX::readMipMaps(), Graphics::TGA::readRLE(), Graphics::DDS::readStandardHeader(), and Graphics::Surface::Surface().
|
protected |
Definition at line 133 of file decoder.h.
Referenced by Graphics::CubeMapCombiner::CubeMapCombiner(), getTXI(), operator=(), Graphics::XEOSITEX::readHeader(), Graphics::TPC::readTXI(), and Graphics::TXB::readTXI().