// doesn't clean the coordinates static BufferedImage ii_clip(IntegralImage img, int x1, int y1, int w, int h) { if (img == null) null; BufferedImage out = newBufferedImage(w, h); for y to h: for x to w: out.setRGB(x, y, ii_getPixel(img, x1+x, y1+y)); ret out; } static BufferedImage ii_clip(IntegralImage ii, DoubleRect r) { ret ii_clip(ii, toRect(r)); } static BufferedImage ii_clip(IntegralImage ii, Rect r) { ret r == null ? null : ii_clip(ii, r.x, r.y, r.w, r.h); }