renderer.clip(shape);
}
// The new clipping region includes the areas of the
// current clipping region with those of the current shape excluded.
else if (mode == EMFConstants.RGN_DIFF) {
Shape clip = renderer.getClip();
if (clip != null) {
Area a = new Area(shape);
a.subtract(new Area(clip));
renderer.setClip(a);
} else {
renderer.setClip(shape);
}
}
// The new clipping region includes the union (combined areas)
// of the current clipping region and the current shape.
else if(mode == EMFConstants.RGN_OR) {
GeneralPath path = new GeneralPath(shape);
Shape clip = renderer.getClip();
if (clip != null) {
path.append(clip, false);
}
renderer.setClip(path);
}
// The new clipping region includes the union of the current
// clipping region and the current shape but without the overlapping areas.
else if(mode == EMFConstants.RGN_XOR) {
Shape clip = renderer.getClip();
if (clip != null) {
Area a = new Area(shape);
a.exclusiveOr(new Area(clip));
renderer.setClip(a);
} else {