BufferedImage buf = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
Graphics g = buf.getGraphics();
g.drawImage(image, 0, 0, w, h, null);
GC gc = x11.XCreateGC(dpy, win, new NativeLong(0), null);
Pixmap pixmap = x11.XCreatePixmap(dpy, win, w, h, 32);
try {
x11.XSetForeground(dpy, gc, new NativeLong(0));
x11.XFillRectangle(dpy, pixmap, gc, 0, 0, w, h);
Raster raster = buf.getData();
int[] pixel = new int[4];