php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
gd_tga.h File Reference
#include "gd.h"
#include "gdhelpers.h"
#include "gd_intern.h"

Go to the source code of this file.

Data Structures

struct  oTga_
 

Macros

#define TGA_TYPE_NO_IMAGE   0
 
#define TGA_TYPE_INDEXED   1
 
#define TGA_TYPE_RGB   2
 
#define TGA_TYPE_GREYSCALE   3
 
#define TGA_TYPE_INDEXED_RLE   9
 
#define TGA_TYPE_RGB_RLE   10
 
#define TGA_TYPE_GREYSCALE_RLE   11
 
#define TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE   32
 
#define TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE   33
 
#define TGA_BPP_8   8
 
#define TGA_BPP_16   16
 
#define TGA_BPP_24   24
 
#define TGA_BPP_32   32
 
#define TGA_RLE_FLAG   128
 

Typedefs

typedef struct oTga_ oTga
 

Functions

int read_header_tga (gdIOCtx *ctx, oTga *tga)
 Reads a TGA header. Reads the header block from a binary TGA file populating the referenced TGA structure.
 
int read_image_tga (gdIOCtx *ctx, oTga *tga)
 Reads a TGA image data into buffer. Reads the image data block from a binary TGA file populating the referenced TGA structure.
 
void free_tga (oTga *tga)
 Cleans up a TGA structure. Dereferences the bitmap referenced in a TGA structure, then the structure itself.
 

Macro Definition Documentation

◆ TGA_BPP_16

#define TGA_BPP_16   16

Definition at line 42 of file gd_tga.h.

◆ TGA_BPP_24

#define TGA_BPP_24   24

Definition at line 43 of file gd_tga.h.

◆ TGA_BPP_32

#define TGA_BPP_32   32

Definition at line 44 of file gd_tga.h.

◆ TGA_BPP_8

#define TGA_BPP_8   8

Definition at line 41 of file gd_tga.h.

◆ TGA_RLE_FLAG

#define TGA_RLE_FLAG   128

Definition at line 46 of file gd_tga.h.

◆ TGA_TYPE_GREYSCALE

#define TGA_TYPE_GREYSCALE   3

Definition at line 34 of file gd_tga.h.

◆ TGA_TYPE_GREYSCALE_RLE

#define TGA_TYPE_GREYSCALE_RLE   11

Definition at line 37 of file gd_tga.h.

◆ TGA_TYPE_INDEXED

#define TGA_TYPE_INDEXED   1

Definition at line 32 of file gd_tga.h.

◆ TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE

#define TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE   32

Definition at line 38 of file gd_tga.h.

◆ TGA_TYPE_INDEXED_RLE

#define TGA_TYPE_INDEXED_RLE   9

Definition at line 35 of file gd_tga.h.

◆ TGA_TYPE_NO_IMAGE

#define TGA_TYPE_NO_IMAGE   0

Definition at line 31 of file gd_tga.h.

◆ TGA_TYPE_RGB

#define TGA_TYPE_RGB   2

Definition at line 33 of file gd_tga.h.

◆ TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE

#define TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE   33

Definition at line 39 of file gd_tga.h.

◆ TGA_TYPE_RGB_RLE

#define TGA_TYPE_RGB_RLE   10

Definition at line 36 of file gd_tga.h.

Typedef Documentation

◆ oTga

typedef struct oTga_ oTga

Function Documentation

◆ free_tga()

void free_tga ( oTga * tga)

Cleans up a TGA structure. Dereferences the bitmap referenced in a TGA structure, then the structure itself.

Parameters
tgaPointer to TGA structure

Definition at line 354 of file gd_tga.c.

◆ read_header_tga()

int read_header_tga ( gdIOCtx * ctx,
oTga * tga )

Reads a TGA header. Reads the header block from a binary TGA file populating the referenced TGA structure.

Parameters
ctxPointer to TGA binary file
tgaPointer to TGA structure
Returns
int 1 on success, -1 on failure

Definition at line 146 of file gd_tga.c.

◆ read_image_tga()

int read_image_tga ( gdIOCtx * ctx,
oTga * tga )

Reads a TGA image data into buffer. Reads the image data block from a binary TGA file populating the referenced TGA structure.

Parameters
ctxPointer to TGA binary file
tgaPointer to TGA structure
Returns
int 0 on success, -1 on failure
Todo
Add more image type support.

Allocate memmory for image block Allocate a chunk of memory for the image block to be passed into.

Read in uncompressed RGB TGA Chunk load the pixel data from an uncompressed RGB type TGA.

Read in RLE compressed RGB TGA Chunk load the pixel data from an RLE compressed RGB type TGA.

Definition at line 209 of file gd_tga.c.