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

TarGa image. More...

#include <tga.h>

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

Public Member Functions

 TGA (Common::SeekableReadStream &tga, bool cubeMap=false)
 
 ~TGA ()
 
- 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  ImageType {
  kImageTypeCMap = 1, kImageTypeTrueColor = 2, kImageTypeBW = 3, kImageTypeRLECMap = 9,
  kImageTypeRLETrueColor = 10, kImageTypeRLEBW = 11
}
 

Private Member Functions

void load (Common::SeekableReadStream &tga)
 
void readHeader (Common::SeekableReadStream &tga, ImageType &imageType, byte &pixelDepth, byte &imageDesc)
 
void readData (Common::SeekableReadStream &tga, ImageType imageType, byte pixelDepth, byte imageDesc)
 
void readRLE (Common::SeekableReadStream &tga, byte pixelDepth, size_t layer)
 
bool isSupportedImageType (ImageType type) const
 

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

TarGa image.

This format is used in the two Neverwinter Nights games, the two Knights of the Old Republic games, Jade Empire and Sonic.

Definition at line 66 of file tga.h.

Member Enumeration Documentation

◆ ImageType

Enumerator
kImageTypeCMap 
kImageTypeTrueColor 
kImageTypeBW 
kImageTypeRLECMap 
kImageTypeRLETrueColor 
kImageTypeRLEBW 

Definition at line 73 of file tga.h.

Constructor & Destructor Documentation

◆ TGA()

Graphics::TGA::TGA ( Common::SeekableReadStream tga,
bool  cubeMap = false 
)

Definition at line 61 of file tga.cpp.

References Graphics::ImageDecoder::_compressed, Graphics::ImageDecoder::_isCubeMap, Graphics::ImageDecoder::_layerCount, and load().

Here is the call graph for this function:

◆ ~TGA()

Graphics::TGA::~TGA ( )

Definition at line 72 of file tga.cpp.

Member Function Documentation

◆ isSupportedImageType()

bool Graphics::TGA::isSupportedImageType ( ImageType  type) const
private

Definition at line 287 of file tga.cpp.

References kImageTypeBW, kImageTypeRLETrueColor, and kImageTypeTrueColor.

Referenced by readHeader().

Here is the caller graph for this function:

◆ load()

void Graphics::TGA::load ( Common::SeekableReadStream tga)
private

Definition at line 75 of file tga.cpp.

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

Referenced by TGA().

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

◆ readData()

void Graphics::TGA::readData ( Common::SeekableReadStream tga,
ImageType  imageType,
byte  pixelDepth,
byte  imageDesc 
)
private

◆ readHeader()

void Graphics::TGA::readHeader ( Common::SeekableReadStream tga,
ImageType imageType,
byte pixelDepth,
byte imageDesc 
)
private

◆ readRLE()

void Graphics::TGA::readRLE ( Common::SeekableReadStream tga,
byte  pixelDepth,
size_t  layer 
)
private

Definition at line 238 of file tga.cpp.

References Graphics::ImageDecoder::_mipMaps, Common::ReadStream::readByte(), and Common::ReadStream::readUint32BE().

Referenced by readData().

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: