php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
gd_tga.h
Go to the documentation of this file.
1#ifndef __TGA_H
2#define __TGA_H 1
3
4#include "gd.h"
5#include "gdhelpers.h"
6
7#include "gd_intern.h"
8
9typedef struct oTga_ {
10 uint8_t identsize; // size of ID field that follows 18 uint8_t header (0 usually)
11 uint8_t colormaptype; // type of colour map 0=none, 1=has palette [IGNORED] Adrian requested no support
12 uint8_t imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
13
14 int colormapstart; // first colour map entry in palette [IGNORED] Adrian requested no support
15 int colormaplength; // number of colours in palette [IGNORED] Adrian requested no support
16 uint8_t colormapbits; // number of bits per palette entry 15,16,24,32 [IGNORED] Adrian requested no support
17
18 int xstart; // image x origin
19 int ystart; // image y origin
20 int width; // image width in pixels
21 int height; // image height in pixels
22 uint8_t bits; // image bits per pixel 8,16,24,32
23 uint8_t alphabits; // alpha bits (low 4bits of header 17)
24 uint8_t fliph; // horizontal or vertical
25 uint8_t flipv; // flip
26 char *ident; // identifcation tag string
27 int *bitmap; // bitmap data
28
30
31#define TGA_TYPE_NO_IMAGE 0
32#define TGA_TYPE_INDEXED 1
33#define TGA_TYPE_RGB 2
34#define TGA_TYPE_GREYSCALE 3
35#define TGA_TYPE_INDEXED_RLE 9
36#define TGA_TYPE_RGB_RLE 10
37#define TGA_TYPE_GREYSCALE_RLE 11
38#define TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE 32
39#define TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE 33
40
41#define TGA_BPP_8 8
42#define TGA_BPP_16 16
43#define TGA_BPP_24 24
44#define TGA_BPP_32 32
45
46#define TGA_RLE_FLAG 128
47
48int read_header_tga(gdIOCtx *ctx, oTga *tga);
49int read_image_tga(gdIOCtx *ctx, oTga *tga);
50void free_tga(oTga *tga);
51
52#endif //__TGA_H
void free_tga(oTga *tga)
Cleans up a TGA structure. Dereferences the bitmap referenced in a TGA structure, then the structure ...
Definition gd_tga.c:354
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 ...
Definition gd_tga.c:209
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 struc...
Definition gd_tga.c:146
struct oTga_ oTga
Definition gd_tga.h:9
char * ident
Definition gd_tga.h:26
int width
Definition gd_tga.h:20
int ystart
Definition gd_tga.h:19
int colormaplength
Definition gd_tga.h:15
uint8_t alphabits
Definition gd_tga.h:23
uint8_t bits
Definition gd_tga.h:22
int colormapstart
Definition gd_tga.h:14
uint8_t colormapbits
Definition gd_tga.h:16
int height
Definition gd_tga.h:21
uint8_t identsize
Definition gd_tga.h:10
uint8_t fliph
Definition gd_tga.h:24
uint8_t flipv
Definition gd_tga.h:25
uint8_t imagetype
Definition gd_tga.h:12
int * bitmap
Definition gd_tga.h:27
int xstart
Definition gd_tga.h:18
uint8_t colormaptype
Definition gd_tga.h:11