@ Override public void clip ( Shape s ) { if ( s instanceof Line2D ) { s = s . getBounds2D ( ) ; } if ( this . clip == null ) { setClip ( s ) ; return ; } Shape ts = this . transform . createTransformedShape ( s ) ; if ( ! ts . intersects ( this . clip . getBounds2D ( ) ) ) { setClip ( new Rectangle2D . Double ( ) ) ; } else { Area a1 = new Area ( ts ) ; Area a2 = new Area ( this . clip ) ; a1 . intersect ( a2 ) ; this . clip = new Path2D . Double ( a1 ) ; } this . clipRef = null ; }
Clips to the intersection of the current clipping region and the specified shape .