Java Code Examples for java.awt.RadialGradientPaint

The following are top voted examples for showing how to use java.awt.RadialGradientPaint. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: jdk8u-jdk   File: WritingInterruptionTest.java   View source code 8 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 2
Project: JavaGraph   File: JAttr.java   View source code 7 votes vote down vote up
/**
 * Creates paint for a vertex with given bounds and (inner) colour.
 */
static public Paint createPaint(Rectangle b, Color c) {
    // only bother with special paint if the vertex is not too small to notice
    if (!GRADIENT_PAINT || b.width < 10 && b.height < 10) {
        return c;
    } else {
        int cx = b.x + b.width / 2;
        int cy = b.y + b.height / 2;
        int fx = b.x + b.width / 3;
        int fy = b.y + 2 * b.height / 3;
        int rx = b.width - fx;
        int ry = b.height - fy;
        float r = (float) Math.sqrt(rx * rx + ry * ry);
        Paint newPaint = new RadialGradientPaint(cx, cy, r, fx, fy, new float[] {0f, 1f},
            getGradient(c), CycleMethod.NO_CYCLE);
        return newPaint;
    }
}
 
Example 3
Project: jdk8u-jdk   File: MlibOpsTest.java   View source code 7 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 4
Project: jdk8u-jdk   File: ConcurrentWritingTest.java   View source code 7 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 5
Project: openjdk-jdk10   File: MlibOpsTest.java   View source code 7 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 6
Project: openjdk-jdk10   File: ConcurrentWritingTest.java   View source code 7 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 7
Project: openjdk-jdk10   File: WritingInterruptionTest.java   View source code 7 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 8
Project: openjdk9   File: MlibOpsTest.java   View source code 7 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 9
Project: openjdk9   File: ConcurrentWritingTest.java   View source code 7 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 10
Project: openjdk9   File: WritingInterruptionTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 11
Project: sjgs   File: RadialLight.java   View source code 6 votes vote down vote up
public RadialLight(final float x, final float y, final float radius, final float intensity) {
	super(x, y, intensity);
	this.radius = radius;

	/******** DRAW THE LIGHT IMAGE **********************************************************/
	final Color[] color = { new Color(0, 0, 0, intensity), new Color(0, 0, 0, 0) };
	lightImage = new BufferedImage((int)(radius*2), (int)(radius*2), BufferedImage.TYPE_INT_ARGB);
	final Graphics2D g2d = (Graphics2D) lightImage.getGraphics();
	final float[] distance = { 0f, 1f };
	g2d.setPaint(new RadialGradientPaint(new Point((int)radius, (int)radius), radius, distance, color));
	g2d.fillOval(0, 0, (int)(radius*2), (int)(radius*2));
	g2d.dispose();
	/***************************************************************************************/

	Handler.lights.add(this);
}
 
Example 12
Project: eSDK_EC_SDK_Java   File: MyButton.java   View source code 6 votes vote down vote up
private void paintButton(Graphics g, Color[] colors) {
	
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	int width = this.getWidth();
	int height = this.getHeight();

	Point2D center = new Point2D.Float(width / 2, height / 2);
	float radius = width / 2;
	float[] dist = { 0.0f, 0.8f };
	RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
	g2.setPaint(paint);
	shape = new RoundRectangle2D.Double(0, 0, width, height, height, height);
	g2.fill(shape);

	Font defaultFont = getFont();
	g2.setFont(defaultFont);
	g2.setColor(Color.BLACK);
	Rectangle2D rect = defaultFont.getStringBounds(text, g2.getFontRenderContext());
	LineMetrics lineMetrics = defaultFont.getLineMetrics(text, g2.getFontRenderContext());
	g2.drawString(text, (float) (width / 2 - rect.getWidth() / 2), (float) ((height / 2)
			+ ((lineMetrics.getAscent() + lineMetrics.getDescent()) / 2 - lineMetrics.getDescent())));

}
 
Example 13
Project: eSDK_EC_SDK_Java   File: MyButton.java   View source code 6 votes vote down vote up
private void paintButton(Graphics g, Color[] colors) {
	
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	int width = this.getWidth();
	int height = this.getHeight();

	Point2D center = new Point2D.Float(width / 2, height / 2);
	float radius = width / 2;
	float[] dist = { 0.0f, 0.8f };
	RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
	g2.setPaint(paint);
	shape = new RoundRectangle2D.Double(0, 0, width, height, height, height);
	g2.fill(shape);

	Font defaultFont = getFont();
	g2.setFont(defaultFont);
	g2.setColor(Color.BLACK);
	Rectangle2D rect = defaultFont.getStringBounds(text, g2.getFontRenderContext());
	LineMetrics lineMetrics = defaultFont.getLineMetrics(text, g2.getFontRenderContext());
	g2.drawString(text, (float) (width / 2 - rect.getWidth() / 2), (float) ((height / 2)
			+ ((lineMetrics.getAscent() + lineMetrics.getDescent()) / 2 - lineMetrics.getDescent())));

}
 
Example 14
Project: eSDK_EC_SDK_Java   File: MyButton.java   View source code 6 votes vote down vote up
private void paintButton(Graphics g, Color[] colors) {
	
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	int width = this.getWidth();
	int height = this.getHeight();

	Point2D center = new Point2D.Float(width / 2, height / 2);
	float radius = width / 2;
	float[] dist = { 0.0f, 0.8f };
	RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
	g2.setPaint(paint);
	shape = new RoundRectangle2D.Double(0, 0, width, height, height, height);
	g2.fill(shape);

	Font defaultFont = getFont();
	g2.setFont(defaultFont);
	g2.setColor(Color.BLACK);
	Rectangle2D rect = defaultFont.getStringBounds(text, g2.getFontRenderContext());
	LineMetrics lineMetrics = defaultFont.getLineMetrics(text, g2.getFontRenderContext());
	g2.drawString(text, (float) (width / 2 - rect.getWidth() / 2), (float) ((height / 2)
			+ ((lineMetrics.getAscent() + lineMetrics.getDescent()) / 2 - lineMetrics.getDescent())));

}
 
Example 15
Project: eSDK_EC_SDK_Java   File: CTDFrame.java   View source code 6 votes vote down vote up
private void paintButton(Graphics g, Color[] colors)
{
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    int width = this.getWidth();
    int height = this.getHeight();

    Point2D center = new Point2D.Float(width / 2, height / 2);
    float radius = width / 2;
    float[] dist = {0.0f, 0.8f};
    RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
    g2.setPaint(paint);
    shape = new RoundRectangle2D.Double(0, 0, width, height, height, height);
    g2.fill(shape);

    Font defaultFont = getFont();
    g2.setFont(defaultFont);
    g2.setColor(Color.BLACK);
    Rectangle2D rect = defaultFont.getStringBounds(text, g2.getFontRenderContext());
    LineMetrics lineMetrics = defaultFont.getLineMetrics(text, g2.getFontRenderContext());
    g2.drawString(text,
        (float)(width / 2 - rect.getWidth() / 2),
        (float)((height / 2) + ((lineMetrics.getAscent() + lineMetrics.getDescent()) / 2 - lineMetrics.getDescent())));

}
 
Example 16
Project: eSDK_EC_SDK_Java   File: MyButton.java   View source code 6 votes vote down vote up
private void paintButton(Graphics g, Color[] colors) {
	
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	int width = this.getWidth();
	int height = this.getHeight();

	Point2D center = new Point2D.Float(width / 2, height / 2);
	float radius = width / 2;
	float[] dist = { 0.0f, 0.8f };
	RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
	g2.setPaint(paint);
	shape = new RoundRectangle2D.Double(0, 0, width, height, height, height);
	g2.fill(shape);

	Font defaultFont = getFont();
	g2.setFont(defaultFont);
	g2.setColor(Color.BLACK);
	Rectangle2D rect = defaultFont.getStringBounds(text, g2.getFontRenderContext());
	LineMetrics lineMetrics = defaultFont.getLineMetrics(text, g2.getFontRenderContext());
	g2.drawString(text, (float) (width / 2 - rect.getWidth() / 2), (float) ((height / 2)
			+ ((lineMetrics.getAscent() + lineMetrics.getDescent()) / 2 - lineMetrics.getDescent())));

}
 
Example 17
Project: jdk8u_jdk   File: MlibOpsTest.java   View source code 6 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 18
Project: jdk8u_jdk   File: ConcurrentWritingTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 19
Project: jdk8u_jdk   File: WritingInterruptionTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 20
Project: lookaside_java-1.8.0-openjdk   File: MlibOpsTest.java   View source code 6 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 21
Project: lookaside_java-1.8.0-openjdk   File: ConcurrentWritingTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 22
Project: lookaside_java-1.8.0-openjdk   File: WritingInterruptionTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 23
Project: mars-sim   File: AbstractRadial.java   View source code 6 votes vote down vote up
/**
 * Returns a radial gradient paint that will be used as overlay for the track or area image
 * to achieve some kind of a 3d effect.
 * @param WIDTH
 * @param RADIUS_FACTOR
 * @return a radial gradient paint that will be used as overlay for the track or area image
 */
protected RadialGradientPaint createArea3DEffectGradient(final int WIDTH, final float RADIUS_FACTOR) {
    final float[] FRACTIONS;
    final Color[] COLORS;

    FRACTIONS = new float[]{
        0.0f,
        0.6f,
        1.0f
    };
    COLORS = new Color[]{
        new Color(1.0f, 1.0f, 1.0f, 0.75f),
        new Color(1.0f, 1.0f, 1.0f, 0.0f),
        new Color(0.0f, 0.0f, 0.0f, 0.3f)
    };
    final Point2D GRADIENT_CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0);

    return new RadialGradientPaint(GRADIENT_CENTER, WIDTH * RADIUS_FACTOR, FRACTIONS, COLORS);
}
 
Example 24
Project: mars-sim   File: RadialBargraph.java   View source code 6 votes vote down vote up
public RadialBargraph() {
    super();
    barGraphColor = ColorDef.RED;
    CENTER = new Point2D.Double();
    LED_CENTER = new Point2D.Double();
    LED_FRACTIONS = new float[]{
        0.0f,
        1.0f
    };
    sectionGradients = new java.util.HashMap<Section, RadialGradientPaint>(4);
    sectionAngles = new java.util.HashMap<Section, Point2D>(4);

    ledTrackStartAngle = getGaugeType().ORIGIN_CORRECTION - (0 * (getGaugeType().APEX_ANGLE / (getMaxValue() - getMinValue())));
    ledTrackAngleExtend = -(getMaxValue() - getMinValue()) * (getGaugeType().APEX_ANGLE / (getMaxValue() - getMinValue()));
    calcBargraphTrack();
    prepareBargraph(getInnerBounds().width);
    setLcdVisible(true);
}
 
Example 25
Project: mars-sim   File: RadialBargraph.java   View source code 6 votes vote down vote up
public RadialBargraph(final Model MODEL) {
    super();
    setModel(MODEL);

    barGraphColor = ColorDef.RED;
    CENTER = new Point2D.Double();
    LED_CENTER = new Point2D.Double();
    LED_FRACTIONS = new float[]{
        0.0f,
        1.0f
    };
    sectionGradients = new java.util.HashMap<Section, RadialGradientPaint>(4);
    sectionAngles = new java.util.HashMap<Section, Point2D>(4);

    ledTrackStartAngle = getGaugeType().ORIGIN_CORRECTION - (0 * (getGaugeType().APEX_ANGLE / (getMaxValue() - getMinValue())));
    ledTrackAngleExtend = -(getMaxValue() - getMinValue()) * (getGaugeType().APEX_ANGLE / (getMaxValue() - getMinValue()));
    calcBargraphTrack();
    prepareBargraph(getGaugeBounds().width);
}
 
Example 26
Project: filthy-rich-clients   File: HighlightedButton.java   View source code 6 votes vote down vote up
/**
 * Creates a new instance of HighlightedButton
 */
public HighlightedButton(String label) {
    super(label);
    
    // Get the Graphics for the image
    Graphics2D g2d = highlight.createGraphics();
    
    // Erase the image with a transparent background
    g2d.setComposite(AlphaComposite.Clear);
    g2d.fillRect(0, 0, HIGHLIGHT_SIZE, HIGHLIGHT_SIZE);
    g2d.setComposite(AlphaComposite.SrcOver);
    
    // Draw the highlight
    Point2D center = new Point2D.Float((float)HIGHLIGHT_SIZE / 2.0f,
            (float)HIGHLIGHT_SIZE / 2.0f);
    float radius = (float)HIGHLIGHT_SIZE / 2.0f;
    float[] dist = {0.0f, .85f};
    Color[] colors = {Color.white, new Color(255, 255, 255, 0)};
    RadialGradientPaint paint = new RadialGradientPaint(center, radius,
            dist, colors);
    g2d.setPaint(paint);
    g2d.fillOval(0, 0, HIGHLIGHT_SIZE, HIGHLIGHT_SIZE);
    g2d.dispose();
}
 
Example 27
Project: infobip-open-jdk-8   File: MlibOpsTest.java   View source code 6 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 28
Project: infobip-open-jdk-8   File: ConcurrentWritingTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 29
Project: infobip-open-jdk-8   File: WritingInterruptionTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 30
Project: jdk8u-dev-jdk   File: MlibOpsTest.java   View source code 6 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 31
Project: jdk8u-dev-jdk   File: ConcurrentWritingTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 32
Project: jdk8u-dev-jdk   File: WritingInterruptionTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 33
Project: jdk7-jdk   File: MlibOpsTest.java   View source code 6 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 34
Project: jdk7-jdk   File: ConcurrentWritingTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 35
Project: jdk7-jdk   File: WritingInterruptionTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 36
Project: openjdk-source-code-learn   File: MlibOpsTest.java   View source code 6 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 37
Project: openjdk-source-code-learn   File: ConcurrentWritingTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 38
Project: openjdk-source-code-learn   File: WritingInterruptionTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 39
Project: OLD-OpenJDK8   File: MlibOpsTest.java   View source code 6 votes vote down vote up
private static BufferedImage createSrcImage() {
    BufferedImage img = createImage();

    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
            new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
Example 40
Project: OLD-OpenJDK8   File: ConcurrentWritingTest.java   View source code 6 votes vote down vote up
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}