File: il_targa.h

package info (click to toggle)
devil 1.6.7-5%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 11,536 kB
  • ctags: 7,441
  • sloc: ansic: 35,573; sh: 8,075; cpp: 7,465; pascal: 792; makefile: 399; python: 47
file content (112 lines) | stat: -rw-r--r-- 2,850 bytes parent folder | download | duplicates (3)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_targa.h
//
// Description: Targa (.tga) functions
//
//-----------------------------------------------------------------------------


#ifndef TARGA_H
#define TARGA_H

#include "il_internal.h"

#ifdef _MSC_VER
#pragma pack(push, tga_struct, 1)
#endif
// Mac OS X fix from Tron Thomas
#ifdef MACOSX 
#pragma pack(1)
#endif

typedef struct TARGAHEAD
{
	ILubyte		IDLen;
	ILubyte		ColMapPresent;
	ILubyte		ImageType;
	ILshort		FirstEntry;
	ILshort		ColMapLen;
	ILubyte		ColMapEntSize;

	ILshort		OriginX;
	ILshort		OriginY;
	ILushort	Width;
	ILushort	Height;
	ILubyte		Bpp;
	ILubyte		ImageDesc;
} IL_PACKSTRUCT TARGAHEAD;

typedef struct TARGAFOOTER
{
	ILuint ExtOff;			// Extension Area Offset
	ILuint DevDirOff;		// Developer Directory Offset
	ILbyte Signature[16];	// TRUEVISION-XFILE
	ILbyte Reserved;		// ASCII period '.'
	ILbyte NullChar;		// NULL
} IL_PACKSTRUCT TARGAFOOTER;
#ifdef MACOSX
#pragma pack()
#endif
#ifdef _MSC_VER
#pragma pack(pop, tga_struct)
#endif

#define TGA_EXT_LEN		495
typedef struct TARGAEXT
{
	// Dev Directory
	//	We don't mess with this

	// Extension Area
	ILshort	Size;				// should be TGA_EXT_LEN
	ILbyte	AuthName[41];		// the image author's name
	ILbyte	AuthComments[324];	// author's comments
	ILshort	Month, Day, Year, Hour, Minute, Second;	// internal date of file
	ILbyte	JobID[41];			// the job description (if any)
	ILshort	JobHour, JobMin, JobSecs;	// the job's time
	ILbyte	SoftwareID[41];		// the software that created this
	ILshort	SoftwareVer;		// the software version number * 100
	ILbyte	SoftwareVerByte;	// the software version letter
	ILint	KeyColor;			// the transparent colour
} TARGAEXT;


// Different Targa formats
#define TGA_NO_DATA				0
#define TGA_COLMAP_UNCOMP		1
#define TGA_UNMAP_UNCOMP		2
#define TGA_BW_UNCOMP			3
#define TGA_COLMAP_COMP			9
#define TGA_UNMAP_COMP			10
#define TGA_BW_COMP				11


// Targa origins
#define IMAGEDESC_ORIGIN_MASK	0x30
#define IMAGEDESC_TOPLEFT		0x20
#define IMAGEDESC_BOTLEFT		0x00
#define IMAGEDESC_BOTRIGHT		0x10
#define IMAGEDESC_TOPRIGHT		0x30


// Internal functions
ILboolean	iIsValidTarga();
ILboolean	iGetTgaHead(TARGAHEAD *Header);
ILboolean	iCheckTarga(TARGAHEAD *Header);
ILboolean	iLoadTargaInternal(ILvoid);
ILboolean	iSaveTargaInternal(ILvoid);
//ILvoid		iMakeString(char *Str);
ILboolean	iReadBwTga(TARGAHEAD *Header);
ILboolean	iReadColMapTga(TARGAHEAD *Header);
ILboolean	iReadUnmapTga(TARGAHEAD *Header);
ILboolean	iUncompressTgaData(ILimage *Image);
ILboolean	i16BitTarga(ILimage *Image);
ILvoid		iGetDateTime(ILuint *Month, ILuint *Day, ILuint *Yr, ILuint *Hr, ILuint *Min, ILuint *Sec);


#endif//TARGA_H