1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * ©1995 Artsoft Development *
6 * 33659 Bielefeld-Senne *
7 * Telefon: (0521) 493245 *
8 * eMail: aeglos@valinor.owl.de *
9 * aeglos@uni-paderborn.de *
10 * q99492@pbhrzx.uni-paderborn.de *
11 *----------------------------------------------------------*
13 ***********************************************************/
22 extern Pixmap test_pix[];
23 extern Pixmap test_clipmask[];
24 extern int test_picture_count;
29 int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename)
31 Image *image, *image_mask;
32 XImageInfo *ximageinfo, *ximageinfo_mask;
33 Pixmap pixmap, pixmap_mask;
39 if (!(image = gifLoad(filename)))
41 printf("Loading GIF image failed -- maybe no GIF...\n");
47 printf("Sorry, GIFs with more than 256 colors are not supported.\n");
51 /* minimize colormap */
54 screen = DefaultScreen(display);
55 visual = DefaultVisual(display, screen);
56 depth = DefaultDepth(display, screen);
58 /* convert internal image structure to X11 XImage */
59 if (!(ximageinfo = imageToXImage(display, screen, visual, depth, image)))
61 fprintf(stderr, "Cannot convert Image to XImage.\n");
65 if (ximageinfo->cmap != DefaultColormap(display, screen))
68 printf("--> '%s' gets own colormap\n", filename);
71 XSetWindowColormap(display, window, ximageinfo->cmap);
74 /* convert XImage to Pixmap */
75 if ((pixmap = ximageToPixmap(display, window, ximageinfo)) == None)
77 fprintf(stderr, "Cannot convert XImage to Pixmap.\n");
82 printf("test_picture_count == %d\n", test_picture_count);
85 test_pix[test_picture_count] = pixmap;
88 /* create mono image for masking */
89 image_mask = monochrome(image);
91 /* convert internal image structure to X11 XImage */
92 if (!(ximageinfo_mask = imageToXImage(display, screen, visual, depth,
95 fprintf(stderr, "Cannot convert Image to XImage.\n");
99 /* convert XImage to Pixmap */
100 if ((pixmap_mask = ximageToPixmap(display, window, ximageinfo_mask)) == None)
102 fprintf(stderr, "Cannot convert XImage to Pixmap.\n");
107 test_clipmask[test_picture_count] = pixmap_mask;
109 test_picture_count++;