XImage *ReadRaw( Display *disp, char Name[], int width, int height ) { FILE *f; XImage *Res = NULL; int Depth, i; char *Data; if( (f = fopen( Name, "r" )) != NULL ) { Depth = 4; if( (Data = (char *)calloc( width * height * Depth / 8, 1 )) != NULL ) { if( (Res = XCreateImage( disp, DefaultVisual( disp, DefaultScreen( disp ) ), Depth, XYPixmap, 0, Data, width, height, 8, 0 )) != NULL ) for( i=0; i<4; i++ ) fread( Data+(3-i)*(width*height/8), width>>3, height, f ); else free( Data ); } fclose( f ); } return Res; } XImage *RemapColors( Display *disp, XImage *Im, unsigned long ColT[] ) { XImage *Tmp = NULL; char *Data; int width, height, depth, x = 1, y; y = ((depth = DefaultDepth( disp, DefaultScreen( disp ) ))-1)>>2; width = Im->width; height = Im->height; while( y>>=1 ) x<<=1; if( (Data = (char *)malloc( width * height * x )) != NULL ) { if( (Tmp = XCreateImage( disp, DefaultVisual( disp, DefaultScreen(disp) ), depth, ZPixmap, 0, Data, width, height, 32, 0 )) != NULL ) for( y=0; ywidth; height1 = Im->height; width2 = ox * width1 / ix; height2 = oy * height1 / iy; Data = (char *)malloc( width2 * height2 * Im->bits_per_pixel / 8 ); Tmp = XCreateImage( disp, DefaultVisual( disp, DefaultScreen( disp ) ), Im->depth, ZPixmap, 0, Data, width2, height2, 32, 0 ); if( ix > ox ) { px1 = &x1; px2 = &x2; dx1 = &ix; dx2 = &ox; } else { px1 = &x2; px2 = &x1; dx1 = &ox; dx2 = &ix; } if( iy > oy ) { py1 = &y1; py2 = &y2; dy1 = &iy; dy2 = &oy; } else { py1 = &y2; py2 = &y1; dy1 = &oy; dy2 = &iy; } Ty = *dy1; for( y1=0, y2=0; (y1