/[LeafOK_CVS]/pvpgn-1.7.4/src/bniutils/tga.h
ViewVC logotype

Contents of /pvpgn-1.7.4/src/bniutils/tga.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:37 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-chdr
no message

1 /*
2 Copyright (C) 2000 Marco Ziech
3 Copyright (C) 2000 Ross Combs (rocombs@cs.nmsu.edu)
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #ifndef INCLUDED_TGA_H
20 #define INCLUDED_TGA_H
21
22 #ifdef JUST_NEED_TYPES
23 # include "compat/uint.h"
24 #else
25 # define JUST_NEED_TYPES
26 # include "compat/uint.h"
27 # undef JUST_NEED_TYPES
28 #endif
29
30 typedef struct {
31 t_uint8 idlen; /* number of bytes in Field 6: 0==no id */
32 t_uint8 cmaptype; /* colormap: 0==none, 1==included, <128==TrueVision, >=128==developer */
33 t_uint8 imgtype; /* pixel format: <128==TrueVision, >=128==developer */
34 t_uint16 cmapfirst; /* first entry offset */
35 t_uint16 cmaplen; /* number of colormap entries */
36 t_uint8 cmapes; /* size of a single colormap entry in bits, 15 forces 1 attribute bit, 32 forces 8 */
37 t_uint16 xorigin; /* x coordinate of lower left hand corner with origin at left of screen */
38 t_uint16 yorigin; /* y coordinate of lower left hand corner with origin at bottom of screen */
39 t_uint16 width; /* width in pixels */
40 t_uint16 height; /* height in pixels */
41 t_uint8 bpp; /* bits per pixel, including attributes and alpha channel */
42 t_uint8 desc; /* image descriptor: bits 0,1,2,3==num attribute bits per pixel, bit 4==horizontal order, bit 5==vertical order, bits 6,7==interleaving */
43 /* field 6, optional */
44 /* field 7, colormap data in ARGB, optional, entries are (min(cmapes/3,8)*3+7)/8 bits wide */
45 t_uint8 *data;
46 /* field 9, developer area, optional */
47 /* field 10, extension area, optional */
48 t_uint32 extareaoff; /* extension area offset, 0==none */
49 t_uint32 devareaoff; /* developer area offset, 0==none */
50 /* magic, null terminated */
51 } t_tgaimg;
52
53 typedef enum {
54 tgaimgtype_empty=0,
55 tgaimgtype_uncompressed_mapped=1,
56 tgaimgtype_uncompressed_truecolor=2,
57 tgaimgtype_uncompressed_monochrome=3,
58 tgaimgtype_rlecompressed_mapped=9,
59 tgaimgtype_rlecompressed_truecolor=10,
60 tgaimgtype_rlecompressed_monochrome=11,
61 tgaimgtype_huffman_mapped=32,
62 tgaimgtype_huffman_4pass_mapped=33
63 } t_tgaimgtype;
64
65 typedef enum {
66 tgadesc_attrbits0=1,
67 tgadesc_attrbits1=2,
68 tgadesc_attrbits2=4,
69 tgadesc_attrbits3=8,
70 tgadesc_horz=16,
71 tgadesc_vert=32,
72 tgadesc_interleave1=64,
73 tgadesc_interleave2=128
74 } t_tgadesc;
75
76 typedef enum {
77 tgacmap_none=0,
78 tgacmap_included=1
79 } t_tgacmap;
80
81 typedef enum {
82 RLE,
83 RAW
84 } t_tgapkttype;
85
86 /* "new" style TGA allowing for developer and extension areas must have this magic at
87 the end of the file */
88 #define TGAMAGIC "TRUEVISION-XFILE."
89
90 #include <stdio.h>
91
92 extern t_tgaimg * new_tgaimg(unsigned int width, unsigned int height, unsigned int bpp, t_tgaimgtype imgtype);
93 extern int getpixelsize(t_tgaimg const *img);
94 extern t_tgaimg * load_tgaheader(void);
95 extern t_tgaimg * load_tga(FILE *f);
96 extern int write_tga(FILE *f, t_tgaimg *img);
97 extern void destroy_img(t_tgaimg * img);
98 extern void print_tga_info(t_tgaimg const * img, FILE * fp);
99
100 #endif
101

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1