#include #include #include #include "xmem.h" extern XColor map[]; /* Inferno colormap */ extern Colormap xcmap; /* Installed color map */ extern int xcflag; /* =1 for private installed colormap */ /* For the incoming image, remap pixel values to those in the color map */ void convert_to_shared(Memimage *i, Rectangle r) { register int x, y; register uchar *pval, *pbase; int ymax, xmax, y_offset; y_offset = i->width*sizeof(ulong); ymax = i->r.max.y; xmax = i->r.max.x; pbase = i->base + i->zero + i->r.min.y*i->width; for(x=i->r.min.x; xr.min.y; yr.min.x; x< i->r.max.x; x++) { for(y=i->r.min.y; yr.max.y; y++) { xval = XGetPixel(xi, x, y); ival = x11toinferno[xval]; XPutPixel(xi, x, y, ival); } } }