final Gradient g = (Gradient) flBackground; final ColorDefinition cdStart = (ColorDefinition) g.getStartColor(); final ColorDefinition cdEnd = (ColorDefinition) g.getEndColor(); boolean bCyclic = g.isCyclic(); double dAngleInDegrees = g.getDirection(); final double dAngleInRadians = ((-dAngleInDegrees * Math.PI) / 180.0); int iAlpha = g.getTransparency(); Bounds bo = are.getBounds();  if (bCyclic) {   }  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(bo.getLeft(), bo.getTop() + bo.getHeight()); p2dEnd = new Point2D.Double(bo.getLeft(), bo.getTop()); } else if (dAngleInDegrees == -90) { p2dEnd = new Point2D.Double(bo.getLeft(), bo.getTop() + bo.getHeight()); p2dStart = new Point2D.Double(bo.getLeft(), bo.getTop()); } else if (dAngleInDegrees > 0) { p2dStart = new Point2D.Double(bo.getLeft(), bo.getTop() + bo.getHeight()); p2dEnd = new Point2D.Double(bo.getLeft() + bo.getWidth(), bo.getTop() + bo.getHeight() - bo.getWidth() * Math.abs(Math.tan(dAngleInRadians))); } else if (dAngleInDegrees < 0) { p2dStart = new Point2D.Double(bo.getLeft(), bo.getTop()); p2dEnd = new Point2D.Double(bo.getLeft() + bo.getWidth(), bo.getTop() + bo.getWidth() * Math.abs(Math.tan(dAngleInRadians))); } else { p2dStart = new Point2D.Double(bo.getLeft(), bo.getTop()); p2dEnd = new Point2D.Double(bo.getLeft() + bo.getWidth(), bo.getTop()); } final Paint pPrevious = _g2d.getPaint(); _g2d.setPaint(new GradientPaint(p2dStart, (Color) _ids.getColor(cdStart), p2dEnd, (Color) _ids .getColor(cdEnd))); _g2d.fill(new Arc2D.Double(are.getTopLeft().getX(), are.getTopLeft().getY(), are.getWidth(), are .getHeight(), are.getStartAngle(), are.getAngleExtent(), toSwingArcType(are.getStyle()))); _g2d.setPaint(pPrevious);
    public void fillArc(ArcRenderEvent are) throws RenderingException    {        final Fill flBackground = are.getBackground();        if (flBackground instanceof ColorDefinition)        {            _g2d.setColor((Color) _ids.getColor((ColorDefinition) flBackground));            _g2d.fill(new Arc2D.Double(are.getTopLeft().getX(), are.getTopLeft().getY(), are.getWidth(), are                .getHeight(), are.getStartAngle(), are.getAngleExtent(), toSwingArcType(are.getStyle())));        }        else if (flBackground instanceof Gradient)        {            // TBD:        }        else if (flBackground instanceof org.eclipse.birt.chart.model.attribute.Image)        {            // TBD:        }    }