6 * Copyright 1989 Jim Frost. See included file "copyright.h" for complete
7 * copyright information.
18 #include <X11/Xutil.h>
19 #include <X11/Xatom.h>
20 #include <X11/cursorfont.h>
22 typedef unsigned long Pixel; /* what X thinks a pixel is */
23 typedef unsigned short Intensity; /* what X thinks an RGB intensity is */
24 typedef unsigned char byte; /* unsigned byte type */
29 /* Display device dependent Information structure */
32 int width; /* Display width and height */
40 /* This struct holds the X-client side bits for a rendered image. */
43 Display *disp; /* destination display */
44 int scrn; /* destination screen */
45 int depth; /* depth of drawable we want/have */
46 Drawable drawable; /* drawable to send image to */
47 Pixel *index; /* array of pixel values allocated */
48 int no; /* number of pixels in the array */
49 int rootimage; /* True if is a root image - eg, retain colors */
50 Pixel foreground; /* foreground and background pixels for mono images */
52 Colormap cmap; /* colormap used for image */
53 GC gc; /* cached gc for sending image */
54 XImage *ximage; /* ximage structure */
57 /* Function declarations */
58 void sendXImage(); /* send.c */
59 XImageInfo *imageToXImage();
60 Pixmap ximageToPixmap();
64 typedef struct rgbmap {
65 unsigned int size; /* size of RGB map */
66 unsigned int used; /* number of colors used in RGB map */
67 int compressed; /* image uses colormap fully */
68 Intensity *red; /* color values in X style */
77 char *title; /* name of image */
78 unsigned int type; /* type of image */
79 RGBMap rgb; /* RGB map of image if IRGB type */
80 unsigned int width; /* width of image in pixels */
81 unsigned int height; /* height of image in pixels */
82 unsigned int depth; /* depth of image in bits if IRGB type */
83 unsigned int pixlen; /* length of pixel if IRGB type */
84 byte *data; /* data rounded to full byte for each row */
85 float gamma; /* gamma of display the image is adjusted for */
88 #define IBITMAP 0 /* image is a bitmap */
89 #define IRGB 1 /* image is RGB */
91 #define BITMAPP(IMAGE) ((IMAGE)->type == IBITMAP)
92 #define RGBP(IMAGE) ((IMAGE)->type == IRGB)
94 #define depthToColors(n) DepthToColorsTable[((n) < 24 ? (n) : 24)]
97 * Architecture independent memory to value conversions.
98 * Note the "Normal" internal format is big endian.
101 #define memToVal(PTR,LEN) ( \
102 (LEN) == 1 ? (unsigned long)( *( (byte *)(PTR)) ) : \
103 (LEN) == 2 ? (unsigned long)(((unsigned long)(*( (byte *)(PTR)) ))<< 8) \
104 + ( *(((byte *)(PTR))+1) ) : \
105 (LEN) == 3 ? (unsigned long)(((unsigned long)(*( (byte *)(PTR)) ))<<16) \
106 + (((unsigned long)(*(((byte *)(PTR))+1)))<< 8) \
107 + ( *(((byte *)(PTR))+2) ) : \
108 (unsigned long)(((unsigned long)(*( (byte *)(PTR)) ))<<24) \
109 + (((unsigned long)(*(((byte *)(PTR))+1)))<<16) \
110 + (((unsigned long)(*(((byte *)(PTR))+2)))<< 8) \
111 + ( *(((byte *)(PTR))+3) ) )
113 #define valToMem(VAL,PTR,LEN) ( \
114 (LEN) == 1 ? (*( (byte *)(PTR) ) = ( VAL ) ) : \
115 (LEN) == 2 ? (*( (byte *)(PTR) ) = (((unsigned long)(VAL))>> 8), \
116 *(((byte *)(PTR))+1) = ( VAL ) ) : \
117 (LEN) == 3 ? (*( (byte *)(PTR) ) = (((unsigned long)(VAL))>>16), \
118 *(((byte *)(PTR))+1) = (((unsigned long)(VAL))>> 8), \
119 *(((byte *)(PTR))+2) = ( VAL ) ) : \
120 (*( (byte *)(PTR) ) = (((unsigned long)(VAL))>>24), \
121 *(((byte *)(PTR))+1) = (((unsigned long)(VAL))>>16), \
122 *(((byte *)(PTR))+2) = (((unsigned long)(VAL))>> 8), \
123 *(((byte *)(PTR))+3) = ( VAL ) ))
128 void cleanUpWindow(); /* window.c */
129 char imageInWindow();
131 int visualClassFromName();
132 char *nameOfVisualClass();
134 extern unsigned long DepthToColorsTable[]; /* new.c */
136 Image *newBitImage();
137 Image *newRGBImage();
139 void freeImageData();
140 void newRGBMapData();
141 void freeRGBMapData();
149 void compress(); /* compress.c */
151 int xliOpenDisplay();
152 void tellAboutDisplay(DisplayInfo *);
153 void xliCloseDisplay(DisplayInfo *);