Search in sources :

Example 36 with RadialGradientPaint

use of java.awt.RadialGradientPaint in project SIMVA-SoS by SESoS.

the class PiePlot method lookupSectionPaint.

/**
 * Returns the paint for the specified section. This is equivalent to
 * <code>lookupSectionPaint(section)</code>.
 * Checks to see if the user set the Paint to be of type RadialGradientPaint
 * If so it adjusts the center and radius to match the Pie
 *
 * @param key  the section key.
 * @param state  PiePlotState.
 *
 * @return The paint for the specified section.
 *
 * @since 1.0.14
 */
protected Paint lookupSectionPaint(Comparable key, PiePlotState state) {
    Paint paint = lookupSectionPaint(key, getAutoPopulateSectionPaint());
    // the current pie segment...
    if (paint instanceof RadialGradientPaint) {
        RadialGradientPaint rgp = (RadialGradientPaint) paint;
        Point2D center = getArcCenter(state, key);
        float radius = (float) Math.max(state.getPieHRadius(), state.getPieWRadius());
        float[] fractions = rgp.getFractions();
        Color[] colors = rgp.getColors();
        paint = new RadialGradientPaint(center, radius, fractions, colors);
    }
    return paint;
}
Also used : Point2D(java.awt.geom.Point2D) Color(java.awt.Color) RadialGradientPaint(java.awt.RadialGradientPaint) Paint(java.awt.Paint) RadialGradientPaint(java.awt.RadialGradientPaint)

Example 37 with RadialGradientPaint

use of java.awt.RadialGradientPaint in project SIMVA-SoS by SESoS.

the class PieChartFXDemo1 method createGradientPaint.

/**
 * A utility method for creating gradient paints.
 *
 * @param c1  color 1.
 * @param c2  color 2.
 *
 * @return A radial gradient paint.
 */
private static RadialGradientPaint createGradientPaint(Color c1, Color c2) {
    Point2D center = new Point2D.Float(0, 0);
    float radius = 200;
    float[] dist = { 0.0f, 1.0f };
    return new RadialGradientPaint(center, radius, dist, new Color[] { c1, c2 });
}
Also used : Point2D(java.awt.geom.Point2D) RadialGradientPaint(java.awt.RadialGradientPaint)

Example 38 with RadialGradientPaint

use of java.awt.RadialGradientPaint in project gephi-plugins-bootcamp by gephi.

the class GlowRenderer method renderJava2D.

public void renderJava2D(Item item, G2DTarget target, PreviewProperties properties) {
    // Params
    Float x = item.getData(NodeItem.X);
    Float y = item.getData(NodeItem.Y);
    Float size = item.getData(NodeItem.SIZE);
    Color color = item.getData(NodeItem.COLOR);
    Color startColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 32);
    Color endColor = new Color(startColor.getRed(), startColor.getGreen(), startColor.getBlue(), 0);
    float radius = size * 6;
    // Get Java2D canvas
    Graphics2D g2 = target.getGraphics();
    RadialGradientPaint p = new RadialGradientPaint(new Point2D.Double(x, y), radius, new float[] { 0.0f, 1.0f }, new Color[] { startColor, endColor });
    g2.setPaint(p);
    g2.fillOval((int) (x - radius), (int) (y - radius), (int) (radius * 2), (int) (radius * 2));
}
Also used : Point2D(java.awt.geom.Point2D) Color(java.awt.Color) RadialGradientPaint(java.awt.RadialGradientPaint) Graphics2D(java.awt.Graphics2D)

Aggregations

RadialGradientPaint (java.awt.RadialGradientPaint)38 Point2D (java.awt.geom.Point2D)31 Color (java.awt.Color)30 Graphics2D (java.awt.Graphics2D)18 Paint (java.awt.Paint)17 LinearGradientPaint (java.awt.LinearGradientPaint)11 Ellipse2D (java.awt.geom.Ellipse2D)9 BufferedImage (java.awt.image.BufferedImage)8 GradientPaint (java.awt.GradientPaint)7 Shape (java.awt.Shape)5 Rectangle2D (java.awt.geom.Rectangle2D)5 Stroke (java.awt.Stroke)4 Area (java.awt.geom.Area)4 RbmModelContainer (cbit.vcell.model.Model.RbmModelContainer)3 BasicStroke (java.awt.BasicStroke)3 MultipleGradientPaint (java.awt.MultipleGradientPaint)3 Point (java.awt.Point)3 Rectangle (java.awt.Rectangle)3 TexturePaint (java.awt.TexturePaint)3 Line2D (java.awt.geom.Line2D)3