Examples of LinearGradientPaint


Examples of java.awt.LinearGradientPaint

        Rectangle2D bounds = s.getBounds2D();
        float       minX   = (float) bounds.getMinX() - 1;
        float       maxX   = (float) bounds.getMaxX() - 1;
        float       midY   = (float) bounds.getCenterY();

        return new LinearGradientPaint(minX, midY, maxX, midY, (new float[] { 0f, 1f }),
                                       new Color[] { transparentColor, innerShadow.bottom });
    }
View Full Code Here

Examples of java.awt.LinearGradientPaint

    }
   
    public GradientChooserDemo() {
        float[] vals = { 0.0f, 1.0f };
        Color[] colors = { Color.WHITE, Color.BLUE };
        gradient = new LinearGradientPaint(0f, 0f, 1f, 1f, vals, colors);
       
        setBackgroundPainter(new MattePainter(gradient, true));
       
        createGradientChooserDemo();
       
View Full Code Here

Examples of java.awt.LinearGradientPaint

    g2.setClip(g.getClip());
    super.paintComponent(g2);
    g2.translate(0, clip.y);

    // Set the alpha mask
    LinearGradientPaint mask = new LinearGradientPaint(0, 0, 0,
        clip.height, new float[] { 0.0f, 0.05f, 0.95f, 1.0f },
        new Color[] { new Color(0, 0, 0, 0), new Color(0, 0, 0, 255),
            new Color(0, 0, 0, 255), new Color(0, 0, 0, 0) });
    // new Color[] { gradientBackground, gradientTranspBackground,
    // gradientTranspBackground, gradientBackground });
View Full Code Here

Examples of java.awt.LinearGradientPaint

                    Color color = decodeColor((String)JSON.get(stop, COLOR_KEY));
                    colors[i] = color;
                }

                paint = new LinearGradientPaint(startX, startY, endX, endY, fractions, colors);
                break;
            }

            case RADIAL_GRADIENT: {
                float centerX = JSON.getFloat(dictionary, CENTER_X_KEY);
View Full Code Here

Examples of java.awt.LinearGradientPaint

      final int y1 = insets.top + height;

      if(y0 != y1) {
        final Graphics2D g2 = (Graphics2D) g;
        final Paint oldPaint = g2.getPaint();
        g2.setPaint(new LinearGradientPaint(x0, y0, x0, y1, new float[] { 0.0f, 0.06f, 0.45f, 0.46f, 0.85f, 0.95f, 1.0f }, new Color[] {
                Color.decode("#ECD1B3"), Color.decode("#DBA76B"), Color.decode("#CB7F2A"), Color.decode("#C06600"),
                Color.decode("#E88E28"), Color.decode("#FFB146"), Color.decode("#FFB146") }));
        g2.fillRect(x0, y0, x1, y1);
        g2.setPaint(new LinearGradientPaint(x0, y0, x0, y1, new float[] { 0.0f, 0.05f, 0.3f, 0.4f, 0.88f, 1.0f }, new Color[] {
                Color.decode("#FFFFFF"), Color.decode("#F4F7FD"), Color.decode("#D6D9DF"), Color.decode("#D6D9DF"),
                Color.decode("#F1F2F4"), Color.decode("#939598") }));
        g2.fillRect(x1, y0, x2, y1);
        g2.setPaint(oldPaint);
        g2.setColor(Color.white);
View Full Code Here

Examples of java.awt.LinearGradientPaint

                    Color color = decodeColor((String)JSON.get(stop, COLOR_KEY));
                    colors[i] = color;
                }

                paint = new LinearGradientPaint(startX, startY, endX, endY, fractions, colors);
                break;
            }

            case RADIAL_GRADIENT: {
                float centerX = JSON.getFloat(dictionary, CENTER_X_KEY);
View Full Code Here

Examples of java.awt.LinearGradientPaint

                    Color color = decodeColor((String)JSON.get(stop, COLOR_KEY));
                    colors[i] = color;
                }

                paint = new LinearGradientPaint(startX, startY, endX, endY, fractions, colors);
                break;
            }

            case RADIAL_GRADIENT: {
                float centerX = JSON.getFloat(dictionary, CENTER_X_KEY);
View Full Code Here

Examples of java.awt.LinearGradientPaint

    private static class LinearGradient extends MultiGradient {
        private LinearGradient() {}

        @Override
        boolean isPaintValid(SunGraphics2D sg2d) {
            LinearGradientPaint paint = (LinearGradientPaint)sg2d.paint;

            if (paint.getFractions().length == 2 &&
                paint.getCycleMethod() != CycleMethod.REPEAT &&
                paint.getColorSpace() != ColorSpaceType.LINEAR_RGB)
            {
                // we can delegate to the optimized two-color gradient
                // codepath, which does not require fragment shader support
                return true;
            }
View Full Code Here

Examples of java.awt.LinearGradientPaint

        float[] fractions = new float[numColors];
        for (int i = 0; i < fractions.length; i++) {
            fractions[i] = i * interval;
        }
        Color[] colors = makeGradientColors(numColors, alpha);
        return new LinearGradientPaint(0.0f, 0.0f,
                                       10.0f, 10.0f,
                                       fractions, colors,
                                       CycleMethod.REFLECT);
    }
View Full Code Here

Examples of java.awt.LinearGradientPaint

                break;

            default:
            case LINEAR:
                paint =
                    new LinearGradientPaint(new Point2D.Float(startX, startY),
                                            new Point2D.Float(endX, endY),
                                            fractions, colors,
                                            cycleMethod, colorSpace,
                                            new AffineTransform());
                break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.