public Picture cropped() { if (crop == null || (crop.getX() == 0 && crop.getY() == 0 && crop.getWidth() == width && crop.getHeight() == height)) { return(this); } Picture result = Picture.Create(crop.getWidth(), crop.getHeight(), color); for (int plane = 0; plane < color.nComp; plane++) { if (data[plane] == null) { continue; } cropSub(data[plane], crop.getX() >> color.compWidth[plane], crop.getY() >> color.compHeight[plane], crop.getWidth() >> color.compWidth[plane], crop.getHeight() >> color.compHeight[plane], width >> color.compWidth[plane], result.data[plane]); } return(result); }
public Picture createCompatible() { return(Picture.Create(width, height, color)); }