#include "gfxloader.h"
+
+
+
+
+
+extern Window window;
+extern void Delay(long);
+
+
+
+
+
+
#ifdef DEBUG
/*
#define DEBUG_GIF
int Read_GIF_to_Bitmap(Display *display, char *filename, Pixmap *pixmap)
{
+ printf("Read_GIF_to_Bitmap\n");
+
+
+
+
return(Read_GIF_to_Pixmap_or_Bitmap(display, filename,
pixmap, READ_GIF_TO_BITMAP));
}
int Read_GIF_to_Pixmap(Display *display, char *filename, Pixmap *pixmap)
{
+ printf("Read_GIF_to_Pixmap\n");
+
+
+
+
return(Read_GIF_to_Pixmap_or_Bitmap(display, filename,
pixmap, READ_GIF_TO_PIXMAP));
}
gcv.background = WhitePixel(display,screen);
gc = XCreateGC(display, root, GCForeground | GCBackground, &gcv);
XPutImage(display,new_pixmap,gc,image,0,0,0,0,width,height);
+
+
+
+
+
+
+ Delay(1000000);
+
+ XPutImage(display,window,gc,image,0,0,0,0,width,height);
+
+ Delay(3000000);
+
+
+
+
+
XFreeGC(display, gc);
}
int screen = DefaultScreen(display);
int depth = DefaultDepth(display, screen);
+
+
+
+
+
+ printf("ConvertXImageDepth:\n");
+ printf("(*image)->depth == %d\n",
+ (*image)->depth);
+ printf("DefaultDepth(display, screen) == %d\n",
+ DefaultDepth(display, screen));
+
+
+
+
if ((*image)->depth != depth)
{
XImage *old_image, *new_image;
+ /*
Visual *visual = DefaultVisual(display,screen);
+ */
int width = (*image)->width;
int height = (*image)->height;
register int dwx, dwy;
byte *data;
- data = (byte *)malloc(width * height);
+
+
+
+
+ printf("ConvertXImageDepth: ---------> CONVERTING...\n");
+
+
+
+
+
+
+ data = (byte *)malloc(width * height * depth);
old_image = *image;
+
+ /*
new_image = XCreateImage(display,visual,depth,
ZPixmap,0,data,width,height,8,0);
+ */
+
+ new_image = XGetImage(display,RootWindow(display,screen),
+ 0,0,width,height,0xffffffff,ZPixmap);
+
+
if (!new_image)
return(GIF_NoMemory);
}
else /* other format change than 8 bit -> 4 bit */
{
- register unsigned long pixel_value;
+ unsigned long pixel_value;
for (dwx=0; dwx<width; dwx++)
{
for (dwy=0; dwy<height; dwy++)
{
pixel_value = XGetPixel(old_image, dwx, dwy);
+
+ if (pixel_value > 0xff)
+ printf("pixel = %lx", pixel_value);
+
XPutPixel(new_image, dwx, dwy, pixel_value);
}
}
int bytes_per_line, bitmap_size;
FILE *file;
+
+
+
+
+ printf("Read_ILBM_to_Bitmap\n");
+
+
+
+
if (!(file = fopen(filename,"r")))
return(ILBM_OpenFailed);