int x, y, i; int bits, depth, ibu, ibpp, offset;
unsigned int x, y; int bits, depth, ibu, ibpp, offset, i;
GetImagePixels(image, width, height, pmap)    XImage *image;    unsigned int width;    unsigned int height;    PixelsMap *pmap;{    char *src;    char *dst;    unsigned int *iptr;    char *data;    int x, y, i;    int bits, depth, ibu, ibpp, offset;    unsigned long lbt;    Pixel pixel, px;    data = image->data;    iptr = pmap->pixelindex;    depth = image->depth;    lbt = low_bits_table[depth];    ibpp = image->bits_per_pixel;    offset = image->xoffset;    if ((image->bits_per_pixel | image->depth) == 1) {	ibu = image->bitmap_unit;	for (y = 0; y < height; y++)	    for (x = 0; x < width; x++, iptr++) {		src = &data[XYINDEX(x, y, image)];		dst = (char *) &pixel;		pixel = 0;		for (i = ibu >> 3; --i >= 0;)		    *dst++ = *src++;		XYNORMALIZE(&pixel, image);		bits = (x + offset) % ibu;		pixel = ((((char *) &pixel)[bits >> 3]) >> (bits & 7)) & 1;		if (ibpp != depth)		    pixel &= lbt;		if (storePixel(pixel, pmap, iptr))		    return (XpmNoMemory);	    }    } else if (image->format == XYPixmap) {	int nbytes, bpl, j;	long plane = 0;	ibu = image->bitmap_unit;	nbytes = ibu >> 3;	bpl = image->bytes_per_line;	for (y = 0; y < height; y++)	    for (x = 0; x < width; x++, iptr++) {		pixel = 0;		plane = 0;		for (i = depth; --i >= 0;) {		    src = &data[XYINDEX(x, y, image) + plane];		    dst = (char *) &px;		    px = 0;		    for (j = nbytes; --j >= 0;)			*dst++ = *src++;		    XYNORMALIZE(&px, image);		    bits = (x + offset) % ibu;		    pixel = (pixel << 1) |			    (((((char *) &px)[bits >> 3]) >> (bits & 7)) & 1);		    plane = plane + (bpl * height);		}		if (ibpp != depth)		    pixel &= lbt;		if (storePixel(pixel, pmap, iptr))		    return (XpmNoMemory);	    }    } else if (image->format == ZPixmap) {	for (y = 0; y < height; y++)	    for (x = 0; x < width; x++, iptr++) {		src = &data[ZINDEX(x, y, image)];		dst = (char *) &px;		px = 0;		for (i = (ibpp + 7) >> 3; --i >= 0;)		    *dst++ = *src++;		ZNORMALIZE(&px, image);		pixel = 0;		for (i = sizeof(unsigned long); --i >= 0;)		    pixel = (pixel << 8) | ((unsigned char *) &px)[i];		if (ibpp == 4) {		    if (x & 1)			pixel >>= 4;		    else			pixel &= 0xf;		}		if (ibpp != depth)		    pixel &= lbt;		if (storePixel(pixel, pmap, iptr))		    return (XpmNoMemory);	    }    } else	return (XpmColorError); /* actually a bad image */    return (XpmSuccess);}