if(!oldParamBlock.getObjectParameter(4).equals(
newParamBlock.getObjectParameter(4))) {
// BorderExtender changed.
// Get source and the left and top padding.
RenderedImage src = oldParamBlock.getRenderedSource(0);
int leftPad = oldParamBlock.getIntParameter(0);
int topPad = oldParamBlock.getIntParameter(2);
// Get source bounds.
Rectangle srcBounds =
new Rectangle(src.getMinX(), src.getMinY(),
src.getWidth(), src.getHeight());
// Get destination bounds.
Rectangle dstBounds =
new Rectangle(srcBounds.x - leftPad,
srcBounds.y - topPad,
srcBounds.width + leftPad +
oldParamBlock.getIntParameter(1),
srcBounds.height + topPad +
oldParamBlock.getIntParameter(3));
// Determine invalid area by subtracting source bounds.
Area invalidArea = new Area(dstBounds);
invalidArea.subtract(new Area(srcBounds));
invalidRegion = invalidArea;
} else if((newParamBlock.getIntParameter(1) < // new R < old R
oldParamBlock.getIntParameter(1) &&
newParamBlock.getIntParameter(3) <= // new B <= old B
oldParamBlock.getIntParameter(3)) ||
(newParamBlock.getIntParameter(3) < // new B < old B
oldParamBlock.getIntParameter(3) &&
newParamBlock.getIntParameter(1) <= // new R <= old R
oldParamBlock.getIntParameter(1))) {
// One or both right and bottom padding decreased.
// Get source and the left and top padding.
RenderedImage src = oldParamBlock.getRenderedSource(0);
int leftPad = oldParamBlock.getIntParameter(0);
int topPad = oldParamBlock.getIntParameter(2);
// Get source bounds.
Rectangle srcBounds =
new Rectangle(src.getMinX(), src.getMinY(),
src.getWidth(), src.getHeight());
// Get old destination bounds.
Rectangle oldBounds =
new Rectangle(srcBounds.x - leftPad,
srcBounds.y - topPad,