static vDescriptor Pixel(vWindow win, int x, int y, int w, int h) {  Image im = win.getCanvas().i;   if (w < 0) { x -= (w = -w);
public static vDescriptor Pixel(vWindow win, int x, int y, int w, int h) { final double gamma = win.gamma; final int[] data = Grab(win, x, y, w, h); if (data == null) { return null;
static vDescriptor Pixel(vWindow win, int x, int y, int w, int h) {    Image im = win.getCanvas().i;    // adjust negative width and height    if (w < 0) {	x -= (w = -w);    }    if (h < 0) {	y -= (h = -h);    }    // factor in dx/dy    x += win.dx;    y += win.dy;    // trim to image bounds	//#%#% should gen bg color instead??    if (x < 0) {	w += x;	x = 0;    }    if (y < 0) {	w += y;	y = 0;    }    if (w > im.getWidth(null)) {	w = im.getWidth(null);    }    if (h > im.getHeight(null)) {	h = im.getHeight(null);    }    if (w <= 0 || h <= 0) {	return null; /*FAIL*/    }    // get data    final int[] data = new int[w * h];    PixelGrabber pg = new PixelGrabber(im, x, y, w, h, data, 0, w);    try {	pg.grabPixels();    } catch (InterruptedException e) {	return null; /*FAIL*/    }    // generate values    final double gamma = win.gamma;    return new vClosure() {	int i = 0;	int previous = 0x08000000; 	// a value we won't ever see	public vDescriptor Resume() {	    if (i >= data.length) {		return null; /*FAIL*/	    }	    int rgb = data[i++];	    if (rgb != previous) {		int r = (rgb >> 16) & 0xFF;		int g = (rgb >>  8) & 0xFF;		int b = rgb & 0xFF;		r = (int) (65535 * Math.pow(r / 255.0, gamma));		g = (int) (65535 * Math.pow(g / 255.0, gamma));		b = (int) (65535 * Math.pow(b / 255.0, gamma));		retval = vString.New(r + "," + g + "," + b);	    }	    return this;	};     }.Resume();}