GLUS
Macros | Functions
glus_image_tga.c File Reference
#include "GL/glus.h"

Macros

#define GLUS_MAX_DIMENSION   16384
 

Functions

GLUSvoid _glusImageGatherSamplePoints (GLUSint sampleIndex[4], GLUSfloat sampleWeight[2], const GLUSfloat st[2], GLUSint width, GLUSint height, GLUSint stride)
 
GLUSboolean _glusFileCheckRead (FILE *f, size_t actualRead, size_t expectedRead)
 
GLUSboolean _glusFileCheckWrite (FILE *f, size_t actualWrite, size_t expectedWrite)
 
GLUSboolean GLUSAPIENTRY glusImageCreateTga (GLUStgaimage *tgaimage, GLUSint width, GLUSint height, GLUSint depth, GLUSenum format)
 Creates a TGA image. More...
 
GLUSboolean GLUSAPIENTRY glusImageLoadTga (const GLUSchar *filename, GLUStgaimage *tgaimage)
 Loads a TGA file. More...
 
GLUSboolean GLUSAPIENTRY glusImageSaveTga (const GLUSchar *filename, const GLUStgaimage *tgaimage)
 Saves a TGA file. More...
 
GLUSvoid GLUSAPIENTRY glusImageDestroyTga (GLUStgaimage *tgaimage)
 Destroys the content of a TGA structure. More...
 
GLUSboolean GLUSAPIENTRY glusImageSampleTga2D (GLUSubyte rgba[4], const GLUStgaimage *tgaimage, const GLUSfloat st[2])
 Samples a RGBA color value from a TGA 2D image. More...
 
GLUSboolean GLUSAPIENTRY glusImageConvertTga (GLUStgaimage *targetImage, const GLUStgaimage *sourceImage, const GLUSenum targetFormat)
 Converts a TGA image into another color format. More...
 

Macro Definition Documentation

#define GLUS_MAX_DIMENSION   16384

Function Documentation

GLUSboolean _glusFileCheckRead ( FILE *  f,
size_t  actualRead,
size_t  expectedRead 
)
GLUSboolean _glusFileCheckWrite ( FILE *  f,
size_t  actualWrite,
size_t  expectedWrite 
)
GLUSvoid _glusImageGatherSamplePoints ( GLUSint  sampleIndex[4],
GLUSfloat  sampleWeight[2],
const GLUSfloat  st[2],
GLUSint  width,
GLUSint  height,
GLUSint  stride 
)
GLUSboolean GLUSAPIENTRY glusImageConvertTga ( GLUStgaimage targetImage,
const GLUStgaimage sourceImage,
const GLUSenum  targetFormat 
)

Converts a TGA image into another color format.

Source and target can not be the same.

Parameters
targetImageThe TGA image structure, containing the converted image.
sourceImageThe TGA image structure, which will be converted.
targetFormatThe target format of the image.
Returns
GLUS_TRUE, if conversion succeeded.
GLUSboolean GLUSAPIENTRY glusImageCreateTga ( GLUStgaimage tgaimage,
GLUSint  width,
GLUSint  height,
GLUSint  depth,
GLUSenum  format 
)

Creates a TGA image.

Parameters
tgaimageThe structure to fill the TGA data.
widthWidth of the image.
heightHeight of the image.
depthDepth of the image.
formatFormat of the image.
Returns
GLUS_TRUE, if creating succeeded.
GLUSvoid GLUSAPIENTRY glusImageDestroyTga ( GLUStgaimage tgaimage)

Destroys the content of a TGA structure.

Has to be called for freeing the resources.

Parameters
tgaimageThe TGA file structure.
GLUSboolean GLUSAPIENTRY glusImageLoadTga ( const GLUSchar filename,
GLUStgaimage tgaimage 
)

Loads a TGA file.

Parameters
filenameThe name of the file to load.
tgaimageThe structure to fill the TGA data.
Returns
GLUS_TRUE, if loading succeeded.
GLUSboolean GLUSAPIENTRY glusImageSampleTga2D ( GLUSubyte  rgba[4],
const GLUStgaimage tgaimage,
const GLUSfloat  st[2] 
)

Samples a RGBA color value from a TGA 2D image.

Sampling uses a bilinear filter.

Parameters
rgbaThe resulting, sampled RGBA color value.
tgaimageThe TGA image structure, containing the 2D texel data.
stTexture coordinate, where to sample the 2D texture.
Returns
GLUS_TRUE, if sampling succeeded.
GLUSboolean GLUSAPIENTRY glusImageSaveTga ( const GLUSchar filename,
const GLUStgaimage tgaimage 
)

Saves a TGA file.

Parameters
filenameThe name of the file to save.
tgaimageThe structure with the TGA data.
Returns
GLUS_TRUE, if saving succeeded.