public Picture cropped() {
if (!cropNeeded())
return this;
Picture result = Picture.create(crop.getWidth(), crop.getHeight(), color);
if(color.planar) {
for (int plane = 0; plane < data.length; 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], crop.getWidth() >> color.compWidth[plane], result.data[plane]);
}
} else {
cropSub(data[0], crop.getX(), crop.getY(), crop.getWidth(),
crop.getHeight(), width * color.nComp, crop.getWidth() * color.nComp, result.data[0]);
}
return result;
}