home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1430
/
display.h
next >
Wrap
C/C++ Source or Header
|
1990-12-28
|
2KB
|
110 lines
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#ifdef vms
#define random rand
#define popen(command,mode) (FILE *) exit(1)
#else
#include <malloc.h>
#include <memory.h>
double
strtod();
long
strtol(),
time();
#endif
/*
Define declarations for the Display program.
*/
#ifndef False
#define False 0
#endif
#define GammaCorrect(color,gamma) \
(pow((double) color/MaxRgb,1.0/gamma)*MaxRgb)
#define Intensity(color) \
(((color).red*77+(color).green*150+(color).blue*29) >> 8)
#define Max(x,y) (((x) > (y)) ? (x) : (y))
#define MaxColormapSize 4096
#define MaxImageSize (4096*4096)
#define MaxRgb 255
#define Min(x,y) (((x) < (y)) ? (x) : (y))
#ifndef True
#define True 1
#endif
/*
Image Id's
*/
#define UnknownId 0
#define XImagerId 1
/*
Image classes:
*/
#define UnknownClass 0
#define DirectClass 1
#define PseudoClass 2
/*
Image compression algorithms:
*/
#define UnknownCompression 0
#define NoCompression 1
#define RunlengthEncodedCompression 2
#define QEncodedCompression 3
/*
Typedef declarations for the Display program.
*/
typedef struct _ColorPacket
{
unsigned char
red,
green,
blue;
unsigned short
index;
} ColorPacket;
typedef struct _RunlengthPacket
{
unsigned char
red,
green,
blue,
length;
unsigned short
index;
} RunlengthPacket;
typedef struct _Image
{
FILE
*file;
char
filename[256];
unsigned int
id,
class,
colors,
packets,
compression,
columns,
rows,
scene,
channel;
char
*comments;
ColorPacket
*colormap;
RunlengthPacket
*pixels;
} Image;