static BufferedImage clipBufferedImage(BufferedImage src, Rectangle clip) { ret clipBufferedImage(src, new Rect(clip)); } static BufferedImage clipBufferedImage(BufferedImage src, Rect r) { if (src == null) null; // fixClipRect r = rectIntersect(r, new Rect(0, 0, src.getWidth(), src.getHeight())); if (rectEmpty(r)) r = new Rect(0, 0, 0, 0); ret src.getSubimage(r.x, r.y, r.width, r.height); } static BufferedImage clipBufferedImage(BufferedImage src, int x, int y, int w, int h) { ret clipBufferedImage(src, Rect(x, y, w, h)); }