1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-98 Artsoft Entertainment *
8 * phone: ++49 +521 290471 *
9 * email: aeglos@valinor.owl.de *
10 *----------------------------------------------------------*
12 ***********************************************************/
27 extern long Counter(void);
31 int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
32 Pixmap *pixmap, Pixmap *pixmap_mask)
34 Image *image, *image_mask;
35 XImageInfo *ximageinfo, *ximageinfo_mask;
46 if (!(image = gifLoad(filename)))
48 printf("Loading GIF image failed -- maybe no GIF...\n");
54 printf(" LOADING '%s' IN %.2f SECONDS\n",
55 filename, (float)(count2-count1)/1000.0);
61 printf("Sorry, GIFs with more than 256 colors are not supported.\n");
65 /* minimize colormap */
70 printf(" COMPRESSING IMAGE COLORMAP IN %.2f SECONDS\n",
71 (float)(count2-count1)/1000.0);
75 screen = DefaultScreen(display);
76 visual = DefaultVisual(display, screen);
77 depth = DefaultDepth(display, screen);
79 /* convert internal image structure to X11 XImage */
80 if (!(ximageinfo = imageToXImage(display, screen, visual, depth, image)))
82 fprintf(stderr, "Cannot convert Image to XImage.\n");
88 printf(" CONVERTING IMAGE TO XIMAGE IN %.2f SECONDS\n",
89 (float)(count2-count1)/1000.0);
93 if (ximageinfo->cmap != DefaultColormap(display, screen))
94 XSetWindowColormap(display, window, ximageinfo->cmap);
96 /* convert XImage to Pixmap */
97 if ((*pixmap = ximageToPixmap(display, window, ximageinfo)) == None)
99 fprintf(stderr, "Cannot convert XImage to Pixmap.\n");
105 printf(" CONVERTING IMAGE TO PIXMAP IN %.2f SECONDS\n",
106 (float)(count2-count1)/1000.0);
110 /* create mono image for masking */
111 image_mask = monochrome(image);
115 printf(" CONVERTING IMAGE TO MASK IN %.2f SECONDS\n",
116 (float)(count2-count1)/1000.0);
120 /* convert internal image structure to X11 XImage */
121 if (!(ximageinfo_mask = imageToXImage(display, screen, visual, depth,
124 fprintf(stderr, "Cannot convert Image to XImage.\n");
130 printf(" CONVERTING MASK TO XIMAGE IN %.2f SECONDS\n",
131 (float)(count2-count1)/1000.0);
135 /* convert XImage to Pixmap */
136 if ((*pixmap_mask = ximageToPixmap(display, window, ximageinfo_mask)) == None)
138 fprintf(stderr, "Cannot convert XImage to Pixmap.\n");
144 printf(" CONVERTING MASK TO PIXMAP IN %.2f SECONDS\n",
145 (float)(count2-count1)/1000.0);