Community
Participate
Working Groups
When specifying clipping not via setClip(Rectangle), but via setClip(Path), currentState.relativeClip is set to null. Within pushState(), the following check then causes a IllegalStateException to be thrown: if (currentState.relativeClip == null) throw new IllegalStateException("The clipping has been modified in" + //$NON-NLS-1$ "a way that cannot be saved and restored."); //$NON-NLS-1$
In order to enable to preserve the clipping-state in case non-rectangular clipping is involved (specified via a path or even a region), we would - based on the current implementation - have to provide additional local Clipping implementations for path and region (one for rectangle is already there), which would have to support the calculation of intersections between arbitrary clippings (rectangle, region, and path). As path does not offer means to perform an intersection calculation, this is not achievable. However, if SWT would support an intersection of clippings as required in bug #87776, we could change the implementation of Graphics to not calculate the clipping intersections locally, but to just keep track of all applied clippings since the last restoration of state and to re-apply them to the Graphics. As such, I regard this as being blocked by bug #87776.