back to the text
/*--------------------------------------------------
*
* myimage.h - Thanks to Marek Czernuszenko
*
*--------------------------------------------------*/
//******************************************************
// $Author: marek $
// $Date: 1995/03/31 23:31:53 $
// $Revision: 1.19 $
/* $Log: myimage.h,v $
* Revision 1.19 1995/03/31 23:31:53 marek
* Very good version - texture maps, blending
* works for both GL and OpenGL.
*
* Revision 1.18 1995/03/30 16:37:00 marek
* Version: opengl/gl works
* * onother man on the slope
* * runway
*
* Revision 1.12 1995/03/20 18:46:21 marek
* Good version (just before having elevation data file)
*
* Revision 1.10 1995/03/10 20:58:08 marek
* Pretty good version. but: trees dont move
*
* Revision 1.9 1995/03/10 20:53:06 marek
* Lighting fixed .
*
* Revision 1.4 1995/03/07 20:37:05 marek
* *** empty log message ***
*
* Revision 1.3 1995/02/28 00:36:27 marek
* cleaning, moving towards 2 elevations, 2 normals (not done jet)
*
* Revision 1.2 1995/02/23 21:26:32 marek
* Added RCS header
*/
//******************************************************
#ifndef __GL_IMAGE_H__
#define __GL_IMAGE_H__
/*
* Defines for image files . . . .
*
* Paul Haeberli - 1984
* Look in /usr/people/4Dgifts/iristools/imgtools for example code!
*
*/
#include
#define IMAGIC 0732
/* colormap of images */
#define CM_NORMAL 0 /* file contains rows of values which
* are either RGB values (zsize == 3)
* or greyramp values (zsize == 1) */
#define CM_DITHERED 1
#define CM_SCREEN 2 /* file contains data which is a screen
* image; getrow returns buffer which
* can be displayed directly with
* writepixels */
#define CM_COLORMAP 3 /* a colormap file */
#define TYPEMASK 0xff00
#define BPPMASK 0x00ff
#define ITYPE_VERBATIM 0x0000
#define ITYPE_RLE 0x0100
#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE)
#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM)
#define BPP(type) ((type) & BPPMASK)
#define RLE(bpp) (ITYPE_RLE | (bpp))
#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp))
#define IBUFSIZE(pixels) ((pixels+(pixels>>6))<<2)
#define RLE_NOP 0x00
#define ierror(p) (((p)->flags&_IOERR)!=0)
#define ifileno(p) ((p)->file)
#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
#define putpix(p,x) (--(p)->cnt>=0 \
? ((int)(*(p)->ptr++=(unsigned)(x))) \
: iflsbuf(p,(unsigned)(x)))
typedef struct {
unsigned short imagic; /* stuff saved on disk . . */
unsigned short type;
unsigned short dim;
unsigned short xsize;
unsigned short ysize;
unsigned short zsize;
unsigned long min;
unsigned long max;
unsigned long wastebytes;
char name[80];
unsigned long colormap;
long file; /* stuff used in core only */
unsigned short flags;
short dorev;
short x;
short y;
short z;
short cnt;
unsigned short *ptr;
unsigned short *base;
unsigned short *tmpbuf;
unsigned long offset;
unsigned long rleend; /* for rle images */
unsigned long *rowstart; /* for rle images */
long *rowsize; /* for rle images */
} IMAGE;
typedef unsigned short ushort ;
typedef unsigned long ulong ;
IMAGE *iopen(char *, register char * , unsigned int type=0, unsigned int dim=0, unsigned int xsize=0, unsigned int ysize=0, unsigned int zsize=0 );
IMAGE *icreate();
int iclose( register IMAGE *);
extern "C" {
extern void sizeofimage( char *, int *, int *);
extern unsigned long *longimagedata(char *);
}
int putrow( register IMAGE *, unsigned short*, unsigned , unsigned );
int getrow( register IMAGE *, unsigned short*, unsigned , unsigned );
int rgbtocpack(ushort*,ushort*,ushort*, ulong *, int );
int rgbatocpack(ushort*,ushort*,ushort*, ushort*, ulong *, int );
int bwtocpack(ushort *, ulong *, int);
int cpacktorgb(ulong *, ushort*,ushort*,ushort*, int);
unsigned short *ibufalloc();
#define IMAGEDEF /* for backwards compatibility */
#endif /* !__GL_IMAGE_H__ */
/*--------------------------------------------------*/