Package java.awt

Examples of java.awt.LinearGradientPaint


            case COLOR: return Color.red;
            case GRADIENT: return
                new GradientPaint(startx, starty, Color.red,
                                  endx, endy, Color.green);
            case LINEAR_GRADIENT: return
                new LinearGradientPaint(startx, starty, endx, endy,
                    new float[] { 0.0f, 0.999f, 1.0f },
                    new Color[] { Color.red, Color.green, Color.blue });
            case RADIAL_GRADIENT: return
                new RadialGradientPaint(startx, starty,
                    (float)Math.sqrt(w * w + h * h),
 
View Full Code Here


    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)
            {
                D3DSurfaceData dstData = (D3DSurfaceData)sg2d.surfaceData;
                D3DGraphicsDevice gd = (D3DGraphicsDevice)
                    dstData.getDeviceConfiguration().getDevice();
                if (gd.isCapPresent(CAPS_LCD_SHADER)) {
View Full Code Here

    for (int i = 0; i < cnt; i++) {
      fractions[i] = ((Number) params.get(4 + i * 2)).floatValue();
      colors[i] = (Color) params.get(5 + i * 2);
    }

    return new LinearGradientPaint(x1, y1, x2, y2, fractions, colors);
  }
View Full Code Here

  public static Paint buildPaint(Paint p, double x, double y, double w, double h) {
    if (p instanceof Color) return p;

    if (p instanceof LinearGradientPaint) {
      LinearGradientPaint gp = (LinearGradientPaint) p;
      double x1 = gp.getStartPoint().getX() * w + x;
      double y1 = gp.getStartPoint().getY() * h + y;
      double x2 = gp.getEndPoint().getX() * w + x;
      double y2 = gp.getEndPoint().getY() * h + y;
      return new LinearGradientPaint(new Point2D.Double(x1, y1), new Point2D.Double(x2, y2), gp.getFractions(), gp.getColors());
    }

    assert false;
    return null;
  }
View Full Code Here

                    Color color = decodeColor(JSON.getString(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

              .getUltraLightColor()
              : scheme.getLightColor();
          Color rightColor = ((fillKind == MenuGutterFillKind.SOFT_FILL) || (fillKind == MenuGutterFillKind.SOFT)) ? scheme
              .getUltraLightColor()
              : scheme.getLightColor();
          LinearGradientPaint gp = new LinearGradientPaint(0, 0,
              textOffset, 0, new float[] { 0.0f, 1.0f },
              new Color[] { leftColor, rightColor },
              CycleMethod.REPEAT);
          graphics.setComposite(LafWidgetUtilities.getAlphaComposite(
              menuItem, 0.7f, g));

          // System.out.println(menuItem.getText()
          // + "["
          // + menuItem.isEnabled()
          // + "] : "
          // + ((AlphaComposite) graphics.getComposite())
          // .getAlpha() + ", " + leftColor + "->"
          // + rightColor);
          //
          graphics.setPaint(gp);
          graphics.fillRect(0, 0, textOffset - 2, menuHeight);
        }
      } else {
        // fix for defect 125 - support of RTL menus
        MenuGutterFillKind fillKind = SubstanceCoreUtilities
            .getMenuGutterFillKind();
        if (fillKind != MenuGutterFillKind.NONE) {
          SubstanceColorScheme scheme = SubstanceColorSchemeUtilities
              .getColorScheme(menuItem, ComponentState.ENABLED);
          Color leftColor = ((fillKind == MenuGutterFillKind.HARD_FILL) || (fillKind == MenuGutterFillKind.HARD)) ? scheme
              .getLightColor()
              : scheme.getUltraLightColor();
          Color rightColor = ((fillKind == MenuGutterFillKind.HARD_FILL) || (fillKind == MenuGutterFillKind.SOFT)) ? scheme
              .getLightColor()
              : scheme.getUltraLightColor();

          LinearGradientPaint gp = new LinearGradientPaint(
              textOffset, 0, menuWidth, 0, new float[] { 0.0f,
                  1.0f },
              new Color[] { leftColor, rightColor },
              CycleMethod.REPEAT);
          graphics.setComposite(LafWidgetUtilities.getAlphaComposite(
View Full Code Here

                final float fStep = 1.0f / (COL_ROBOT.length-1);
                final float[] fractions = new float[COL_ROBOT.length];
                for (int i = 1; i < fractions.length; ++i) {
                    fractions[i] = fractions[i - 1] + fStep;
                }
                thePaint = new LinearGradientPaint(0, 0, 0, this.height, fractions, COL_ROBOT, MultipleGradientPaint.CycleMethod.REPEAT);
            } else {
                thePaint = new GradientPaint(0, 0, COL_ROBOT[this.goal.robotNumber], 0, this.height, Color.DARK_GRAY);
            }
            g2d.setPaint(thePaint);
            final Shape outerShape = new Rectangle2D.Double(0, 0, this.width, this.height);
View Full Code Here

                final float fStep = 1.0f / (COL_ROBOT.length-1);
                final float[] fractions = new float[COL_ROBOT.length];
                for (int i = 1; i < fractions.length; ++i) {
                    fractions[i] = fractions[i - 1] + fStep;
                }
                thePaint = new LinearGradientPaint(0, 0, 0, this.height, fractions, COL_ROBOT, MultipleGradientPaint.CycleMethod.REPEAT);
            } else {
                thePaint = new GradientPaint(0, 0, COL_ROBOT[this.goal.robotNumber], 0, this.height, Color.DARK_GRAY);
            }
            g2d.setPaint(thePaint);
            final Shape outerShape = new Rectangle2D.Double(0, 0, this.width, this.height);
View Full Code Here

                final float fStep = 1.0f / (COL_ROBOT.length-1);
                final float[] fractions = new float[COL_ROBOT.length];
                for (int i = 1; i < fractions.length; ++i) {
                    fractions[i] = fractions[i - 1] + fStep;
                }
                thePaint = new LinearGradientPaint(0, 0, 0, this.height, fractions, COL_ROBOT, MultipleGradientPaint.CycleMethod.REPEAT);
            } else {
                thePaint = new GradientPaint(0, 0, COL_ROBOT[this.goal.robotNumber], 0, this.height, Color.DARK_GRAY);
            }
            g2d.setPaint(thePaint);
            final Shape outerShape = new Rectangle2D.Double(0, 0, this.width, this.height);
View Full Code Here

                        final float fStep = 1.0f / (COL_ROBOT.length-1);
                        final float[] fractions = new float[COL_ROBOT.length];
                        for (int i = 1; i < fractions.length; ++i) {
                            fractions[i] = fractions[i - 1] + fStep;
                        }
                        thePaint = new LinearGradientPaint(vWallWidth*2, hWallWidth*2, vWallWidth*2, height-1-hWallWidth*2, fractions, COL_ROBOT, MultipleGradientPaint.CycleMethod.REPEAT);
                    } else {
                        thePaint = new GradientPaint(0, 0, COL_ROBOT[goal.robotNumber], 0, height-1, Color.DARK_GRAY);
                    }
                    g2d.setPaint(thePaint);
                    final Shape outerShape = new Rectangle2D.Double(
View Full Code Here

TOP

Related Classes of java.awt.LinearGradientPaint

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.