6 typedef unsigned short Intensity; /* what X thinks an RGB intensity is */
8 /* This struct holds the X-client side bits for a rendered image. */
11 Display *disp; /* destination display */
12 int scrn; /* destination screen */
13 int depth; /* depth of drawable we want/have */
14 Drawable drawable; /* drawable to send image to */
15 Pixel *index; /* array of pixel values allocated */
16 int no; /* number of pixels in the array */
17 int rootimage; /* True if is a root image - eg, retain colors */
18 Pixel foreground; /* foreground and background pixels for mono images */
20 Colormap cmap; /* colormap used for image */
21 GC gc; /* cached gc for sending image */
22 XImage *ximage; /* ximage structure */
25 /* Function declarations */
26 void sendXImage(); /* send.c */
27 XImageInfo *imageToXImage();
28 Pixmap ximageToPixmap();
34 unsigned int size; /* size of RGB map */
35 unsigned int used; /* number of colors used in RGB map */
36 int compressed; /* image uses colormap fully */
37 Intensity *red; /* color values in X style */
46 unsigned int type; /* type of image */
47 RGBMap rgb; /* RGB map of image if IRGB type */
48 unsigned int width; /* width of image in pixels */
49 unsigned int height; /* height of image in pixels */
50 unsigned int depth; /* depth of image in bits if IRGB type */
51 unsigned int pixlen; /* length of pixel if IRGB type */
52 byte *data; /* data rounded to full byte for each row */
53 float gamma; /* gamma of display the image is adjusted for */
56 #define IBITMAP 0 /* image is a bitmap */
57 #define IRGB 1 /* image is RGB */
59 #define BITMAPP(IMAGE) ((IMAGE)->type == IBITMAP)
60 #define RGBP(IMAGE) ((IMAGE)->type == IRGB)
62 #define depthToColors(n) DepthToColorsTable[((n) < 24 ? (n) : 24)]
65 * Architecture independent memory to value conversions.
66 * Note the "Normal" internal format is big endian.
69 #define memToVal(PTR,LEN) ( \
70 (LEN) == 1 ? (unsigned long)( *( (byte *)(PTR)) ) : \
71 (LEN) == 2 ? (unsigned long)(((unsigned long)(*( (byte *)(PTR)) ))<< 8) \
72 + ( *(((byte *)(PTR))+1) ) : \
73 (LEN) == 3 ? (unsigned long)(((unsigned long)(*( (byte *)(PTR)) ))<<16) \
74 + (((unsigned long)(*(((byte *)(PTR))+1)))<< 8) \
75 + ( *(((byte *)(PTR))+2) ) : \
76 (unsigned long)(((unsigned long)(*( (byte *)(PTR)) ))<<24) \
77 + (((unsigned long)(*(((byte *)(PTR))+1)))<<16) \
78 + (((unsigned long)(*(((byte *)(PTR))+2)))<< 8) \
79 + ( *(((byte *)(PTR))+3) ) )
81 #define valToMem(VAL,PTR,LEN) ( \
82 (LEN) == 1 ? (*( (byte *)(PTR) ) = ( VAL ) ) : \
83 (LEN) == 2 ? (*( (byte *)(PTR) ) = (((unsigned long)(VAL))>> 8), \
84 *(((byte *)(PTR))+1) = ( VAL ) ) : \
85 (LEN) == 3 ? (*( (byte *)(PTR) ) = (((unsigned long)(VAL))>>16), \
86 *(((byte *)(PTR))+1) = (((unsigned long)(VAL))>> 8), \
87 *(((byte *)(PTR))+2) = ( VAL ) ) : \
88 (*( (byte *)(PTR) ) = (((unsigned long)(VAL))>>24), \
89 *(((byte *)(PTR))+1) = (((unsigned long)(VAL))>>16), \
90 *(((byte *)(PTR))+2) = (((unsigned long)(VAL))>> 8), \
91 *(((byte *)(PTR))+3) = ( VAL ) ))
96 extern unsigned long DepthToColorsTable[];
100 void freeImageData();
101 void newRGBMapData();
102 void freeRGBMapData();
106 Image *Read_GIF_to_Image();
112 Pixmap XImage_to_Pixmap(Display *, Window, XImageInfo *);
113 XImageInfo *Image_to_XImage(Display *, int, Visual *, unsigned int, Image *);
114 void XImage_to_Drawable(XImageInfo *, int, int, int, int,
115 unsigned int, unsigned int);