@Override
    public void fill(Shape s) {
        if (s instanceof Rectangle2D) {
            Rectangle2D r = (Rectangle2D) s;
            if (r.isEmpty()) {
                return;
            }
            this.sb.append("<rect ");
            appendOptionalElementIDFromHint(this.sb);
            this.sb.append("x=\"").append(geomDP(r.getX()))
                    .append("\" y=\"").append(geomDP(r.getY()))
                    .append("\" width=\"").append(geomDP(r.getWidth()))
                    .append("\" height=\"").append(geomDP(r.getHeight()))
                    .append("\" ");
            this.sb.append("style=\"").append(getSVGFillStyle()).append("\" ");
            if (!this.transform.isIdentity()) {
            	this.sb.append("transform=\"").append(getSVGTransform(
            		this.transform)).append("\" ");
            }
            this.sb.append(getClipPathRef());
            this.sb.append("/>");
        } else if (s instanceof Ellipse2D) {
            Ellipse2D e = (Ellipse2D) s;
            this.sb.append("<ellipse ");
            appendOptionalElementIDFromHint(this.sb);
            this.sb.append("cx=\"").append(geomDP(e.getCenterX()))
                    .append("\" cy=\"").append(geomDP(e.getCenterY()))
                    .append("\" rx=\"").append(geomDP(e.getWidth() / 2.0))
                    .append("\" ry=\"").append(geomDP(e.getHeight() / 2.0))
                    .append("\" ");
            this.sb.append("style=\"").append(getSVGFillStyle()).append("\" ");
            if (!this.transform.isIdentity()) {
            	this.sb.append("transform=\"").append(getSVGTransform(
            		this.transform)).append("\" ");
            }
            this.sb.append(getClipPathRef());
            this.sb.append("/>");        
        } else if (s instanceof Path2D) {
            Path2D path = (Path2D) s;
            this.sb.append("<g ");
            appendOptionalElementIDFromHint(this.sb);
            this.sb.append("style=\"").append(getSVGFillStyle());
            this.sb.append("; stroke: none").append("\" ");
            if (!this.transform.isIdentity()) {
            	this.sb.append("transform=\"").append(getSVGTransform(
            		this.transform)).append("\" ");
            }
            this.sb.append(getClipPathRef());
            this.sb.append(">");
            this.sb.append("<path ").append(getSVGPathData(path)).append("/>");
            this.sb.append("</g>");
        }  else {
            fill(new GeneralPath(s));  // handled as a Path2D next time through
        }
    }
@Override
    public void fill(Shape s) {
        if (s instanceof Rectangle2D) {
            Rectangle2D r = (Rectangle2D) s;
            if (r.isEmpty()) {
                return;
            }
            this.sb.append("<rect ");
            appendOptionalElementIDFromHint(this.sb);
            this.sb.append("x=\"").append(geomDP(r.getX()))
                    .append("\" y=\"").append(geomDP(r.getY()))
                    .append("\" width=\"").append(geomDP(r.getWidth()))
                    .append("\" height=\"").append(geomDP(r.getHeight()))
                    .append("\" ");
            this.sb.append("style=\"").append(getSVGFillStyle()).append("\" ");
            if (!this.transform.isIdentity()) {
            	this.sb.append("transform=\"").append(getSVGTransform(
            		this.transform)).append("\" ");
            }
            this.sb.append(getClipPathRef());
            this.sb.append("/>");
        } else if (s instanceof Ellipse2D) {
            Ellipse2D e = (Ellipse2D) s;
            this.sb.append("<ellipse ");
            appendOptionalElementIDFromHint(this.sb);
            this.sb.append("cx=\"").append(geomDP(e.getCenterX()))
                    .append("\" cy=\"").append(geomDP(e.getCenterY()))
                    .append("\" rx=\"").append(geomDP(e.getWidth() / 2.0))
                    .append("\" ry=\"").append(geomDP(e.getHeight() / 2.0))
                    .append("\" ");
            this.sb.append("style=\"").append(getSVGFillStyle()).append("\" ");
            if (!this.transform.isIdentity()) {
            	this.sb.append("transform=\"").append(getSVGTransform(
            		this.transform)).append("\" ");
            }
            this.sb.append(getClipPathRef());
            this.sb.append("/>");        
        } else if (s instanceof Path2D) {
            Path2D path = (Path2D) s;
            this.sb.append("<g ");
            appendOptionalElementIDFromHint(this.sb);
            this.sb.append("style=\"").append(getSVGFillStyle());
            this.sb.append("; stroke: none").append("\" ");
            if (!this.transform.isIdentity()) {
            	this.sb.append("transform=\"").append(getSVGTransform(
            		this.transform)).append("\" ");
            }
            this.sb.append(getClipPathRef());
            this.sb.append(">");
            this.sb.append("<path ").append(getSVGPathData(path)).append("/>");
            this.sb.append("</g>");
        }  else {
            fill(new GeneralPath(s));  
        }
    }
@ Override public void fill ( Shape s ) { if ( s instanceof Rectangle2D ) { Rectangle2D r = ( Rectangle2D ) s ; if ( r . isEmpty ( ) ) { return ; } this . sb . append ( "<rect " ) ; appendOptionalElementIDFromHint ( this . sb ) ; this . sb . append ( "x=\"" ) . append ( geomDP ( r . getX ( ) ) ) . append ( "\" y=\"" ) . append ( geomDP ( r . getY ( ) ) ) . append ( "\" width=\"" ) . append ( geomDP ( r . getWidth ( ) ) ) . append ( "\" height=\"" ) . append ( geomDP ( r . getHeight ( ) ) ) . append ( "\" " ) ; this . sb . append ( "style=\"" ) . append ( getSVGFillStyle ( ) ) . append ( "\" " ) ; if ( ! this . transform . isIdentity ( ) ) { this . sb . append ( "transform=\"" ) . append ( getSVGTransform ( this . transform ) ) . append ( "\" " ) ; } this . sb . append ( getClipPathRef ( ) ) ; this . sb . append ( "/>" ) ; } else if ( s instanceof Ellipse2D ) { Ellipse2D e = ( Ellipse2D ) s ; this . sb . append ( "<ellipse " ) ; appendOptionalElementIDFromHint ( this . sb ) ; this . sb . append ( "cx=\"" ) . append ( geomDP ( e . getCenterX ( ) ) ) . append ( "\" cy=\"" ) . append ( geomDP ( e . getCenterY ( ) ) ) . append ( "\" rx=\"" ) . append ( geomDP ( e . getWidth ( ) / 2.0 ) ) . append ( "\" ry=\"" ) . append ( geomDP ( e . getHeight ( ) / 2.0 ) ) . append ( "\" " ) ; this . sb . append ( "style=\"" ) . append ( getSVGFillStyle ( ) ) . append ( "\" " ) ; if ( ! this . transform . isIdentity ( ) ) { this . sb . append ( "transform=\"" ) . append ( getSVGTransform ( this . transform ) ) . append ( "\" " ) ; } this . sb . append ( getClipPathRef ( ) ) ; this . sb . append ( "/>" ) ; } else if ( s instanceof Path2D ) { Path2D path = ( Path2D ) s ; this . sb . append ( "<g " ) ; appendOptionalElementIDFromHint ( this . sb ) ; this . sb . append ( "style=\"" ) . append ( getSVGFillStyle ( ) ) ; this . sb . append ( "; stroke: none" ) . append ( "\" " ) ; if ( ! this . transform . isIdentity ( ) ) { this . sb . append ( "transform=\"" ) . append ( getSVGTransform ( this . transform ) ) . append ( "\" " ) ; } this . sb . append ( getClipPathRef ( ) ) ; this . sb . append ( ">" ) ; this . sb . append ( "<path " ) . append ( getSVGPathData ( path ) ) . append ( "/>" ) ; this . sb . append ( "</g>" ) ; } else { fill ( new GeneralPath ( s ) ) ; // handled as a Path2D next time through } }
Fills the specified shape with the current {@code paint}.  There is
direct handling for {@code Rectangle2D}, {@code Ellipse2D} and
{@code Path2D}.  All other shapes are mapped to a {@code GeneralPath}
and then filled.

@param s  the shape ({@code null} not permitted).

@see #draw(java.awt.Shape)
Fills the specified shape with the current { @code paint } . There is direct handling for { @code Rectangle2D } { @code Ellipse2D } and { @code Path2D } . All other shapes are mapped to a { @code GeneralPath } and then filled .