+ Image *image;
+ XImageInfo *ximageinfo;
+
+ /*
+ Image *image, *image_mask;
+ XImageInfo *ximageinfo, *ximageinfo_mask;
+ */
+
+ int screen;
+ Visual *visual;
+ unsigned int depth;
+
+#ifdef DEBUG_TIMING
+ count1 = Counter();
+#endif
+
+ if ((image = Read_PCX_to_Image(filename)) == NULL)
+ return PCX_FileInvalid;
+
+#ifdef DEBUG_TIMING
+ count2 = Counter();
+ printf(" LOADING '%s' IN %.2f SECONDS\n",
+ filename, (float)(count2-count1)/1000.0);
+ count1 = Counter();
+#endif
+
+ /* create image mask */
+ Image_to_Mask(image);
+
+#ifdef DEBUG_TIMING
+ count2 = Counter();
+ printf(" CONVERTING IMAGE TO MASK IN %.2f SECONDS\n",
+ (float)(count2-count1)/1000.0);
+ count1 = Counter();
+#endif
+
+ screen = DefaultScreen(display);
+ visual = DefaultVisual(display, screen);
+ depth = DefaultDepth(display, screen);
+
+ /* convert internal image structure to X11 XImage */
+ if (!(ximageinfo = Image_to_XImage(display, screen, visual, depth, image)))
+ {
+ fprintf(stderr, "Cannot convert Image to XImage.\n");
+ exit(1);
+ }
+
+#ifdef DEBUG_TIMING
+ count2 = Counter();
+ printf(" CONVERTING IMAGE TO XIMAGE IN %.2f SECONDS\n",
+ (float)(count2-count1)/1000.0);
+ count1 = Counter();
+#endif
+
+ if (ximageinfo->cmap != DefaultColormap(display, screen))
+ XSetWindowColormap(display, window, ximageinfo->cmap);
+
+ /* convert XImage to Pixmap */
+ if (!(XImage_to_Pixmap(display, window, ximageinfo, image)))
+ {
+ fprintf(stderr, "Cannot convert XImage to Pixmap.\n");
+ exit(1);
+ }
+
+#ifdef DEBUG_TIMING
+ count2 = Counter();
+ printf(" CONVERTING IMAGE TO PIXMAP IN %.2f SECONDS\n",
+ (float)(count2-count1)/1000.0);
+ count1 = Counter();
+#endif
+
+ *pixmap = ximageinfo->pixmap;
+ *pixmap_mask = ximageinfo->pixmap_mask;
+
+ return(PCX_Success);