summaryrefslogtreecommitdiffstats
path: root/kernel/kls_tga/fmt_codec_tga_defs.h
blob: c708df4f55ab7d0dbd499a37335822c0a29927c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*  This file is part of ksquirrel-libs (http://ksquirrel.sf.net)

    Copyright (c) 2004 Dmitry Baryshev <ksquirrel@tut.by>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation;
    either version 2 of the License, or (at your option) any later
    version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    as32 with this library; see the file COPYING.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#ifndef KSQUIRREL_READ_IMAGE_tga
#define KSQUIRREL_READ_IMAGE_tga

struct TGA_FILEHEADER
{
	u8	IDlength;
	u8	ColorMapType; /*  1==we have colormap, 0==no  */
	u8	ImageType;
							/*	0==no image data
								1==uncompressed+color map
								2==uncompressed+true color
								3==uncompressed+B&W
								9==RLE+color map
								10==RLE+true color
								11==RLE+B&W
							*/
	u16 	ColorMapSpecFirstEntryIndex;
	u16 	ColorMapSpecLength;
	u8 	ColorMapSpecEntrySize; /*  15,16,24,32  */
	u16 	ImageSpecX;
	u16 	ImageSpecY;
	u16 	ImageSpecW;
	u16 	ImageSpecH;
	u8 	ImageSpecDepth; /*  8 or 16 or 24 or 32  */
	u8 	ImageSpecDescriptor; /*  7 6 5 4 3 2 1 0   */

}PACKED;

struct TGA_IMAGEDATA
{
	u8	*ID; /*  length of this == TGA_FILEHEADER::IDlength  */
	u8	*ColorMapData; /*  -//-   */
	u8	*Image; /*  widthxheight pixels */

}PACKED;

struct TGA_FOOTER
{
	u32	ExtensionAreaOffset;
	u32	DeveloperDirectoryOffset;
	u8	Signature[16];	/*  "TRUEVISION-XFILE"  */
	u8	punct;		/*  '.'  */
	u8	TGAnull;		/* 0x0  */

}PACKED;

/*  we'll skip "developer area" & "extension area", we don't need to read them.  */

#endif