newtree/include/tga.h

82 lines
2.3 KiB
C
Raw Normal View History

/*
tga.h
targa image hangling
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifndef __tga_h
#define __tga_h
#include "gcc_attr.h"
#include "qtypes.h"
#ifndef __GNUC__
2001-05-30 22:22:58 +00:00
# if defined (__DECC) && defined (__ALPHA)
2001-05-30 22:45:36 +00:00
// uses __unaligned
2001-05-30 22:22:58 +00:00
# else
2001-05-30 22:45:36 +00:00
# define __unaligned
2001-05-30 22:22:58 +00:00
# if defined (__BORLANDC__) || defined (_MSC_VER)
# if (defined(__BORLANDC__) && (__BORLANDC__ < 0x550))
# pragma option -a1
# else
# pragma pack(push, tgainclude)
# pragma pack(1)
# endif
# else
2001-05-30 22:22:58 +00:00
# error do some data packing magic here (#pragma pack?)
# endif
# endif
2001-05-30 22:45:36 +00:00
#else
# define __unaligned
2000-12-11 15:37:48 +00:00
#endif
typedef struct _TargaHeader {
2001-05-30 22:59:00 +00:00
unsigned char id_length __attribute__((packed));
unsigned char colormap_type __attribute__((packed));
unsigned char image_type __attribute__((packed));
2001-05-30 22:45:36 +00:00
__unaligned unsigned short colormap_index __attribute__((packed));
__unaligned unsigned short colormap_length __attribute__((packed));
2001-05-30 22:59:00 +00:00
unsigned char colormap_size __attribute__((packed));
2001-05-30 22:45:36 +00:00
__unaligned unsigned short x_origin __attribute__((packed));
__unaligned unsigned short y_origin __attribute__((packed));
__unaligned unsigned short width __attribute__((packed));
__unaligned unsigned short height __attribute__((packed));
2001-05-30 22:59:00 +00:00
unsigned char pixel_size __attribute__((packed));
unsigned char attributes __attribute__((packed));
} TargaHeader;
#if defined (__BORLANDC__) || defined (_MSC_VER)
# if (defined(__BORLANDC__) && (__BORLANDC__ < 0x550))
# pragma option -a4
# else
# pragma pack(pop, tgainclude)
# endif
2000-12-11 15:37:48 +00:00
#endif
2000-12-11 14:59:01 +00:00
byte *LoadTGA (QFile *fin);
void WriteTGAfile (const char *tganame, byte *data, int width, int height);
#endif // __tga_h