Examples of RadialGradientPaint


Examples of java.awt.RadialGradientPaint

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

                paint = new RadialGradientPaint(centerX, centerY, radius, fractions, colors);
                break;
            }

            default: {
                throw new UnsupportedOperationException();
View Full Code Here

Examples of java.awt.RadialGradientPaint

                center.getY() - 0.5 * radius);
        Color[] colors = new Color[]{
            transparent ? new Color(255, 255, 255, 128) : Color.WHITE,
            transparent ? new Color(0, 255, 255, 32) : Color.CYAN};
        float[] fractions = new float[]{0f, 1f};
        RadialGradientPaint paint = new RadialGradientPaint(center, radius,
                focus, fractions, colors,
                MultipleGradientPaint.CycleMethod.NO_CYCLE);
        return paint;
    }
View Full Code Here

Examples of java.awt.RadialGradientPaint

  public PaintView(BlurTest win, BufferedImage img) {
    super(img);

    this.win = win;

    paint = new RadialGradientPaint(new Point2D.Float(0, 0), 3,
        new float[]{0.0f, 1.0f}, new Color[]{new Color(255, 255, 255, 255), new Color(255, 255, 255, 0)});
    brush = new java.awt.geom.Ellipse2D.Float(-5, -5, 11, 11);

    imgg = img.createGraphics();
View Full Code Here

Examples of java.awt.RadialGradientPaint

        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();

        try {
View Full Code Here

Examples of java.awt.RadialGradientPaint

        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();

        try {
View Full Code Here

Examples of org.apache.batik.ext.awt.RadialGradientPaint

            currentStream.write(myPat.getColorSpaceOut(fill));

            return true;
        }
        if (paint instanceof RadialGradientPaint) {
            RadialGradientPaint rgp = (RadialGradientPaint)paint;

            // There is essentially no way to support repeate
            // in PDF for radial gradients (the one option would
            // be to 'grow' the outer circle until it fully covered
            // the bounds and then grow the stops accordingly, the
            // problem is that this may require an extremely large
            // number of stops for cases where the focus is near
            // the edge of the outer circle).  so we rasterize.
            MultipleGradientPaint.CycleMethodEnum cycle = rgp.getCycleMethod();
            if (cycle != MultipleGradientPaint.NO_CYCLE) {
                return false;
            }

            AffineTransform transform;
            transform = new AffineTransform(getBaseTransform());
            transform.concatenate(getTransform());
            transform.concatenate(rgp.getTransform());

            List theMatrix = new java.util.ArrayList();
            double [] mat = new double[6];
            transform.getMatrix(mat);
            for (int idx = 0; idx < mat.length; idx++) {
                theMatrix.add(new Double(mat[idx]));
            }

            double ar = rgp.getRadius();
            Point2D ac = rgp.getCenterPoint();
            Point2D af = rgp.getFocusPoint();

            List theCoords = new java.util.ArrayList();
            double dx = af.getX() - ac.getX();
            double dy = af.getY() - ac.getY();
            double d = Math.sqrt(dx * dx + dy * dy);
            if (d > ar) {
                // the center point af must be within the circle with
                // radius ar centered at ac so limit it to that.
                double scale = (ar * .9999) / d;
                dx = dx * scale;
                dy = dy * scale;
            }

            theCoords.add(new Double(ac.getX() + dx)); // Fx
            theCoords.add(new Double(ac.getY() + dy)); // Fy
            theCoords.add(new Double(0));
            theCoords.add(new Double(ac.getX()));
            theCoords.add(new Double(ac.getY()));
            theCoords.add(new Double(ar));

            Color[] cols = rgp.getColors();
            List someColors = new java.util.ArrayList();
            for (int count = 0; count < cols.length; count++) {
                Color cc = cols[count];
                if (cc.getAlpha() != 255) {
                    return false// PDF can't do alpha
                }

                someColors.add(new PDFColor(cc.getRed(), cc.getGreen(),
                                            cc.getBlue()));
            }

            float[] fractions = rgp.getFractions();
            List theBounds = new java.util.ArrayList();
            for (int count = 1; count < fractions.length - 1; count++) {
                float offset = fractions[count];
                theBounds.add(new Double(offset));
            }
View Full Code Here

Examples of org.apache.batik.ext.awt.RadialGradientPaint

                                                  SVG_FY_ATTRIBUTE,
                                                  coordSystemType,
                                                  uctx);

            // <!> FIXME: colorSpace ignored for radial gradient at this time
            return new RadialGradientPaint(c,
                                           r,
                                           f,
                                           offsets,
                                           colors,
                                           spreadMethod,
View Full Code Here

Examples of org.apache.batik.ext.awt.RadialGradientPaint

                                                  SVG_FY_ATTRIBUTE,
                                                  coordSystemType,
                                                  uctx);

            // <!> FIXME: colorSpace ignored for radial gradient at this time
            return new RadialGradientPaint(c,
                                           r,
                                           f,
                                           offsets,
                                           colors,
                                           spreadMethod,
View Full Code Here

Examples of org.apache.batik.ext.awt.RadialGradientPaint

    else
    {
      if (repeat_.getSelectedIndex() == 0)
      {
        gradient_ =
          new RadialGradientPaint(
            JGradientChooser.CENTER_,
            (float) JGradientChooser.CENTER_.distance(JGradientChooser.END_) / 2,
            JGradientChooser.CENTER_,
            JGradientChooser.fractions_,
            colors,
            MultipleGradientPaint.NO_CYCLE,
            MultipleGradientPaint.SRGB);
      }
      else
        if (repeat_.getSelectedIndex() == 1)
        {

          gradient_ =
            new RadialGradientPaint(
              JGradientChooser.CENTER_,
              (float) JGradientChooser.CENTER_.distance(JGradientChooser.END_) / 2,
              JGradientChooser.CENTER_,
              JGradientChooser.fractions_,
              colors,
              MultipleGradientPaint.REFLECT,
              MultipleGradientPaint.SRGB);
        }
        else
        {
          gradient_ =
            new RadialGradientPaint(
              JGradientChooser.CENTER_,
              (float) JGradientChooser.CENTER_.distance(JGradientChooser.END_) / 2,
              JGradientChooser.CENTER_,
              JGradientChooser.fractions_,
              colors,
View Full Code Here

Examples of org.apache.batik.ext.awt.RadialGradientPaint

      transformed_gradient_ =
        new LinearGradientPaint(start, end, tmp_gradient.getFractions(), tmp_gradient.getColors(), tmp_gradient.getCycleMethod(), MultipleGradientPaint.SRGB);
    }
    else
    {
      RadialGradientPaint tmp_gradient = (RadialGradientPaint) gradient_;

      Point2D.Float center =  new Point2D.Float(center_.x+x,center_.y+y);
        Point2D.Float end =  new Point2D.Float(end_.x+x,end_.y+y);

      transformed_gradient_ =
        new RadialGradientPaint(
          center,
          (float) center.distance(end) / 2,
          center,
          tmp_gradient.getFractions(),
          tmp_gradient.getColors(),
          tmp_gradient.getCycleMethod(),
          MultipleGradientPaint.SRGB);
    }

    Graphics2D g2 = (Graphics2D) g;
    Color c = g.getColor();
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.