if(roiProperty == null ||
roiProperty == java.awt.Image.UndefinedProperty ||
!(roiProperty instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI roi = (ROI)roiProperty;
// Determine the effective destination bounds.
Rectangle dstBounds = null;
PlanarImage dst = op.getRendering();
if(dst instanceof AreaOpImage &&
((AreaOpImage)dst).getBorderExtender() == null) {
AreaOpImage aoi = (AreaOpImage)dst;
dstBounds =
new Rectangle(aoi.getMinX() + aoi.getLeftPadding(),
aoi.getMinY() + aoi.getTopPadding(),
aoi.getWidth() -
aoi.getLeftPadding() -
aoi.getRightPadding(),
aoi.getHeight() -
aoi.getTopPadding() -
aoi.getBottomPadding());
} else {
dstBounds = dst.getBounds();
}
// If necessary, clip the ROI to the destination bounds.
// XXX Is this desirable?
if(!dstBounds.contains(roi.getBounds())) {
roi = roi.intersect(new ROIShape(dstBounds));
}
return roi;
}