static BufferedImage clipBufferedImage(BufferedImage src, Rectangle clip) { ret clipBufferedImage(src, new Rect(clip)); } static BufferedImage clipBufferedImage(BufferedImage src, Rect r) { if (src == null || r == null) null; // fixClipRect r = intersectRects(r, new Rect(0, 0, src.getWidth(), src.getHeight())); if (rectEmpty(r)) null; // can't make zero-sized BufferedImage ret src.getSubimage(r.x, r.y, r.w, r.h); } static BufferedImage clipBufferedImage(BufferedImage src, int x, int y, int w, int h) { ret clipBufferedImage(src, Rect(x, y, w, h)); }