}
}*/
    public void fillPolygon(PolygonRenderEvent pre) throws RenderingException    {        final Fill flBackground = pre.getBackground();        final Location[] loa = pre.getPoints();        final int[][] i2a = getCoordinatesAsInts(loa);        if (flBackground instanceof ColorDefinition)        {            final ColorDefinition cd = (ColorDefinition) flBackground;            _g2d.setColor((Color) _ids.getColor(cd));            _g2d.fill(new Polygon(i2a[0], i2a[1], loa.length));        }        else if (flBackground instanceof Gradient)        {            final Gradient g = (Gradient) flBackground;            final ColorDefinition cdStart = (ColorDefinition) g.getStartColor();            final ColorDefinition cdEnd = (ColorDefinition) g.getEndColor();            final boolean bRadial = g.isCyclic();            final double dAngleInDegrees = g.getDirection();            final double dAngleInRadians = ((-dAngleInDegrees * Math.PI) / 180.0);            //final int iAlpha = g.getTransparency();            final double dMinX = BaseRenderer.getX(loa, IConstants.MIN);            final double dMaxX = BaseRenderer.getX(loa, IConstants.MAX);            final double dMinY = BaseRenderer.getY(loa, IConstants.MIN);            final double dMaxY = BaseRenderer.getY(loa, IConstants.MAX);            if (bRadial)            {                //DefaultLoggerImpl.instance().log(ILogger.WARNING, "Radial                // gradients are not supported in the "+getClass()+" renderer");            }            if (dAngleInDegrees < -90 || dAngleInDegrees > 90)            {                throw new RenderingException("Cannot render a gradient at angle=" + dAngleInDegrees                    + "; supported range is [90 >= 0 >= -90]");            }            Point2D.Double p2dStart, p2dEnd;            if (dAngleInDegrees == 90)            {                p2dStart = new Point2D.Double(dMinX, dMaxY);                p2dEnd = new Point2D.Double(dMinX, dMinY);            }            else if (dAngleInDegrees == -90)            {                p2dStart = new Point2D.Double(dMinX, dMinY);                p2dEnd = new Point2D.Double(dMinX, dMaxY);            }            else if (dAngleInDegrees > 0)            {                p2dStart = new Point2D.Double(dMinX, dMaxY);                p2dEnd = new Point2D.Double(dMaxX, dMaxY - (dMaxX - dMinX) * Math.abs(Math.tan(dAngleInRadians)));            }            else if (dAngleInDegrees < 0)            {                p2dStart = new Point2D.Double(dMinX, dMinY);                p2dEnd = new Point2D.Double(dMaxX, dMinY + (dMaxX - dMinX) * Math.abs(Math.tan(dAngleInRadians)));            }            else            {                p2dStart = new Point2D.Double(dMinX, dMinY);                p2dEnd = new Point2D.Double(dMaxX, dMinY);            }            _g2d.setPaint(new GradientPaint(p2dStart, (Color) _ids.getColor(cdStart), p2dEnd, (Color) _ids                .getColor(cdEnd)));            _g2d.fill(new Polygon(i2a[0], i2a[1], loa.length));        }        else if (flBackground instanceof org.eclipse.birt.chart.model.attribute.Image)        {            final String sUrl = ((org.eclipse.birt.chart.model.attribute.Image) flBackground).getURL();            java.awt.Image img = null;            try            {                img = (java.awt.Image) _ids.loadImage(new URL(sUrl));            }            catch (ImageLoadingException ilex )            {                throw new RenderingException(ilex);            }            catch (MalformedURLException muex )            {                throw new RenderingException(muex);            }            final Shape shClip = _g2d.getClip();            _g2d.setClip(new Polygon(i2a[0], i2a[1], loa.length));            final double dMinX = BaseRenderer.getX(loa, IConstants.MIN);            final double dMaxX = BaseRenderer.getX(loa, IConstants.MAX);            final double dMinY = BaseRenderer.getY(loa, IConstants.MIN);            final double dMaxY = BaseRenderer.getY(loa, IConstants.MAX);            final Size szImage = _ids.getSize(img);            final int iXRepeat = (int) (Math.ceil((dMaxX - dMinX) / szImage.getWidth()));            final int iYRepeat = (int) (Math.ceil((dMaxY - dMinY) / szImage.getHeight()));            final ImageObserver io = (ImageObserver) _ids.getObserver();            for (int i = 0; i < iXRepeat; i++)            {                for (int j = 0; j < iYRepeat; j++)                {                    _g2d.drawImage(img, (int) (dMinX + i * szImage.getWidth()),                        (int) (dMinY + j * szImage.getHeight()), io);                }            }            //img(); // FLUSHED LATER BY CACHE; DON'T FLUSH HERE            _g2d.setClip(shClip); // RESTORE        }        if (pre.iObjIndex > 0)        {            try            {                Bounds bo = pre.getBounds();                _g2d.setColor(Color.red);                _g2d.setFont(new Font("Arial", Font.BOLD, 14));                _g2d.drawString("" + pre.iObjIndex, (int) (bo.getLeft() + bo.getWidth() / 2), (int) (bo.getTop() + bo                    .getHeight() / 2));            }            catch (Exception ex )            {                ex.printStackTrace();            }        }    }