Package java.awt

Examples of java.awt.MultipleGradientPaint


        //if(picker.reflectedRadio.isSelected()) {
            cycle = MultipleGradientPaint.CycleMethod.REFLECT;
        }
       
        // create the underlying gradient paint
        MultipleGradientPaint paint = null;
        if(isRadial()) { //picker.styleCombo.getSelectedItem().toString().equals("Radial")) {
            paint = new RadialGradientPaint(
            start, (float)start.distance(end),start,
            fractions, colors, cycle, MultipleGradientPaint.ColorSpaceType.SRGB, null
            );
View Full Code Here


        g.fill(rect);

        // fill in the gradient
        Point2D start = new Point2D.Float(0,0);
        Point2D end = new Point2D.Float(track_width,0);
        MultipleGradientPaint paint = new LinearGradientPaint(
                (float)start.getX(),
                (float)start.getY(),
                (float)end.getX(),
                (float)end.getY(),
                fractions,colors);
View Full Code Here

     *
     * @param length
     * @return a gradient Paint with values between 0.0 and length
     */
    private MultipleGradientPaint getFlatGradient(JXGradientChooser chooser, double length) {
        MultipleGradientPaint gp = chooser.getGradient();

        // set up the data for the gradient
        float[] fractions = gp.getFractions();
        Color[] colors = gp.getColors();

        // fill in the gradient
        Point2D start = new Point2D.Float(0, 0);
        Point2D end = new Point2D.Float((float) length, 0);
        MultipleGradientPaint paint = new LinearGradientPaint(
                (float) start.getX(),
                (float) start.getY(),
                (float) end.getX(),
                (float) end.getY(),
                fractions, colors);
View Full Code Here

            this.repeatedRadio.setSelected(true);
            gradientPreview.setRepeated(true);
        }
        gradientPreview.setGradient(mgrad);
        //reflectedRadio.setSelected()
        MultipleGradientPaint old = this.getGradient();
        gradient = mgrad;
        firePropertyChange("gradient",old,getGradient());
        repaint();
    }
View Full Code Here

         *   - the number of gradient "stops" is <= MAX_FRACTIONS
         *   - the destination has support for fragment shaders
         */
        @Override
        boolean isPaintValid(SunGraphics2D sg2d) {
            MultipleGradientPaint paint = (MultipleGradientPaint)sg2d.paint;
            // REMIND: ugh, this creates garbage; would be nicer if
            // we had a MultipleGradientPaint.getNumStops() method...
            if (paint.getFractions().length > MULTI_MAX_FRACTIONS) {
                return false;
            }

            OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
            OGLGraphicsConfig gc = dstData.getOGLGraphicsConfig();
View Full Code Here

         *   - the number of gradient "stops" is <= MAX_FRACTIONS
         *   - the destination has support for fragment shaders
         */
        @Override
        boolean isPaintValid(SunGraphics2D sg2d) {
            MultipleGradientPaint paint = (MultipleGradientPaint)sg2d.paint;
            // REMIND: ugh, this creates garbage; would be nicer if
            // we had a MultipleGradientPaint.getNumStops() method...
            if (paint.getFractions().length > MULTI_MAX_FRACTIONS) {
                return false;
            }

            OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
            OGLGraphicsConfig gc = dstData.getOGLGraphicsConfig();
View Full Code Here

         *   - the number of gradient "stops" is <= MAX_FRACTIONS
         *   - the destination has support for fragment shaders
         */
        @Override
        boolean isPaintValid(SunGraphics2D sg2d) {
            MultipleGradientPaint paint = (MultipleGradientPaint)sg2d.paint;
            // REMIND: ugh, this creates garbage; would be nicer if
            // we had a MultipleGradientPaint.getNumStops() method...
            if (paint.getFractions().length > MULTI_MAX_FRACTIONS_D3D) {
                return false;
            }

            D3DSurfaceData dstData = (D3DSurfaceData)sg2d.surfaceData;
            D3DGraphicsDevice gd = (D3DGraphicsDevice)
View Full Code Here

  public static int getBrightness(Paint p) {
    if (p == null) return -1;
    if (p instanceof Color) return getBrightness((Color) p);

    if (p instanceof MultipleGradientPaint) {
      MultipleGradientPaint gp = (MultipleGradientPaint) p;
      int b = 128; for (Color c : gp.getColors()) b += getBrightness(c);
      return b / gp.getColors().length;
    }

    assert false;
    return -1;
  }
View Full Code Here

            LinearGradient lg = new LinearGradient(p1.getX(), p1.getY(),
                    p2.getX(), p2.getY(), false, CycleMethod.NO_CYCLE, stops);
            this.gc.setStroke(lg);
            this.gc.setFill(lg);
        } else if (paint instanceof MultipleGradientPaint) {
            MultipleGradientPaint mgp = (MultipleGradientPaint) paint;
            Color[] colors = mgp.getColors();
            float[] fractions = mgp.getFractions();
            Stop[] stops = new Stop[colors.length];
            for (int i = 0; i < colors.length; i++) {
                stops[i] = new Stop(fractions[i], awtColorToJavaFX(colors[i]));
            }
View Full Code Here

TOP

Related Classes of java.awt.MultipleGradientPaint

Copyright © 2018 www.massapicom. 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.