- Main Page
- Classes
- Files

- File List
- File Members

# flTextureTGA.h File Reference

`#include "flGlobal.h"`
`#include "flTexture.h"`

Go to the source code of this file.

## Functions
Texture * | texLoadTGA (char *inPath)
| Loads a tga image into a Texture struct.
bool | texSaveTGA (Texture *inTex, char *inPath)
| Saves a tga image from a Texture struct.

## Function Documentation

Texture* texLoadTGA | ( | char * | inPath | ) |

Loads a tga image into a Texture struct.

Parameters:

  | inPath | Path to the tga image in memory or file.

Returns:
  A pointer to the texture struct created to hold the tga, or NULL on failure.

Warning:
  Currently 16-bit tga's are not properly supported however all others are, including RLE.

Definition at line 33 of file flTextureTGA.c.

References debugError, FILE_MODE_BINARY, FILE_MODE_READ, FILE_SEEK_CUR, fileClose(), fileOpen(), fileRead(), fileSeek(), NULL, palCreate(), Palette::palData, palGrayscaleT8(), Palette::palPixelFormat, tgaFileHeader::tgaBPP, tgaFileHeader::tgaDescriptor, tgaFileHeader::tgaHeight, tgaFileHeader::tgaIdentSize, tgaFileHeader::tgaImageType, tgaFileHeader::tgaPaletteBPP, tgaFileHeader::tgaPaletteLen, tgaFileHeader::tgaPaletteStart, tgaFileHeader::tgaPaletteType, tgaFileHeader::tgaWidth, tgaFileHeader::tgaXStart, and tgaFileHeader::tgaYStart.

Referenced by texLoad().

bool texSaveTGA | ( | Texture * | inTex,
|  | char * | inPath |
| ) |  |  |

Saves a tga image from a Texture struct.

Parameters:

  | inTex | The texture to save as a tga.
  | inPath | Path to the file to which the tga image will be written.

Returns:
  Whether the tga was saved successfully or not.

Warning:
  Currently 16-bit tga's are not properly supported however all others are, though not saved with RLE.

Definition at line 334 of file flTextureTGA.c.

References debugError, debugWarning, FILE_MODE_BINARY, FILE_MODE_WRITE, fileOpen(), fileWrite(), FL_TEXTURE_PRESERVENONALPHA, Palette::palData, Palette::palEntries, Palette::palPixelFormat, Texture::texAlpha, texBPP(), Texture::texData, Texture::texDataWidth, Texture::texHeight, Texture::texPalette, texPalettized(), Texture::texPixelFormat, Texture::texSwizzled, texUnswizzle(), Texture::texWidth, tgaFileHeader::tgaBPP, tgaFileHeader::tgaDescriptor, tgaFileHeader::tgaHeight, tgaFileHeader::tgaIdentSize, tgaFileHeader::tgaImageType, tgaFileHeader::tgaPaletteBPP, tgaFileHeader::tgaPaletteLen, tgaFileHeader::tgaPaletteStart, tgaFileHeader::tgaPaletteType, tgaFileHeader::tgaWidth, tgaFileHeader::tgaXStart, and tgaFileHeader::tgaYStart.

Referenced by texSave().