Shape roiShape = srcROI.getAsShape();
if (roiShape != null) {
// Determine the area of overlap.
Area a = new Area(rect);
a.intersect(new Area(roiShape));
if(!a.isEmpty()) {
// If the area is non-empty overlay the pixels.
overlayPixels(tile, src, a);
}