xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | List of all members
Graphics::DDS Class Reference

DDS texture. More...

#include <dds.h>

Inheritance diagram for Graphics::DDS:
Inheritance graph
[legend]
Collaboration diagram for Graphics::DDS:
Collaboration graph
[legend]

Classes

struct  DDSPixelFormat
 The specific pixel format of the included image data. More...
 

Public Member Functions

 DDS (Common::SeekableReadStream &dds)
 
 ~DDS ()
 
- Public Member Functions inherited from Graphics::ImageDecoder
 ImageDecoder ()
 
 ImageDecoder (const ImageDecoder &image)
 
virtual ~ImageDecoder ()
 
ImageDecoderoperator= (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 MipMapgetMipMap (size_t mipMap, size_t layer=0) const
 Return a mip map. More...
 
void decompress ()
 Manually decompress the texture image data. More...
 
const TXIgetTXI () 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...
 

Private Types

enum  DataType { kDataTypeDirect, kDataType4444 }
 

Private Member Functions

void load (Common::SeekableReadStream &dds)
 
void readHeader (Common::SeekableReadStream &dds, DataType &dataType)
 
void readStandardHeader (Common::SeekableReadStream &dds, DataType &dataType)
 
void readBioWareHeader (Common::SeekableReadStream &dds, DataType &dataType)
 
void readData (Common::SeekableReadStream &dds, DataType dataType)
 
void detectFormat (const DDSPixelFormat &format, DataType &dataType)
 
void setSize (MipMap &mipMap)
 

Additional Inherited Members

- Protected Types inherited from Graphics::ImageDecoder
typedef Common::PtrVector< MipMapMipMaps
 
- Static Protected Member Functions inherited from Graphics::ImageDecoder
static void decompress (MipMap &out, const MipMap &in, PixelFormatRaw format)
 
- Protected Attributes inherited from Graphics::ImageDecoder
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
 

Detailed Description

DDS texture.

There are two different DDS file formats:

Definition at line 44 of file dds.h.

Member Enumeration Documentation

◆ DataType

Enumerator
kDataTypeDirect 
kDataType4444 

Definition at line 50 of file dds.h.

Constructor & Destructor Documentation

◆ DDS()

Graphics::DDS::DDS ( Common::SeekableReadStream dds)

Definition at line 47 of file dds.cpp.

References load().

Here is the call graph for this function:

◆ ~DDS()

Graphics::DDS::~DDS ( )

Definition at line 51 of file dds.cpp.

Member Function Documentation

◆ detectFormat()

void Graphics::DDS::detectFormat ( const DDSPixelFormat format,
DataType dataType 
)
private

◆ load()

void Graphics::DDS::load ( Common::SeekableReadStream dds)
private

Definition at line 54 of file dds.cpp.

References Common::StackException::add(), readData(), and readHeader().

Referenced by DDS().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readBioWareHeader()

void Graphics::DDS::readBioWareHeader ( Common::SeekableReadStream dds,
DataType dataType 
)
private

◆ readData()

void Graphics::DDS::readData ( Common::SeekableReadStream dds,
DataType  dataType 
)
private

Definition at line 217 of file dds.cpp.

References Graphics::ImageDecoder::_mipMaps, kDataType4444, kDataTypeDirect, Common::kReadError, Common::ReadStream::read(), and Common::ReadStream::readUint16LE().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readHeader()

void Graphics::DDS::readHeader ( Common::SeekableReadStream dds,
DataType dataType 
)
private

Definition at line 68 of file dds.cpp.

References kDDSID, readBioWareHeader(), readStandardHeader(), and Common::ReadStream::readUint32BE().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readStandardHeader()

void Graphics::DDS::readStandardHeader ( Common::SeekableReadStream dds,
DataType dataType 
)
private

◆ setSize()

void Graphics::DDS::setSize ( MipMap mipMap)
private

Definition at line 211 of file dds.cpp.

References Graphics::ImageDecoder::_formatRaw, Graphics::getDataSize(), Graphics::ImageDecoder::MipMap::height, Graphics::ImageDecoder::MipMap::size, and Graphics::ImageDecoder::MipMap::width.

Referenced by readBioWareHeader(), and readStandardHeader().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: