Package javafx.scene.paint

Examples of javafx.scene.paint.Stop


        chart.setFilled(true);
        chart.setNoOfSectors(24);
        for (int i = 0; i <= 24; i++) {
            chart.addData(i, new XYChart.Data<>(i < 10 ? "0" + i + ":00" : i + ":00", RND.nextDouble() * 55 - 15));           
        }
        chart.setGradientStops(new Stop(0.00000, Color.web("#3552a0")),
                               new Stop(0.09090, Color.web("#456acf")),
                               new Stop(0.27272, Color.web("#45a1cf")),
                               new Stop(0.36363, Color.web("#30c8c9")),
                               new Stop(0.45454, Color.web("#30c9af")),
                               new Stop(0.50909, Color.web("#56d483")),
                               new Stop(0.72727, Color.web("#9adb49")),
                               new Stop(0.81818, Color.web("#efd750")),
                               new Stop(0.90909, Color.web("#ef9850")),
                               new Stop(1.00000, Color.web("#ef6050")));
        chart.setPolygonMode(true);
    }
View Full Code Here


    private void initGraphics() {
        Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT)); // "OpenSans"

        barColor    = getSkinnable().getBarColor();
        barGradient = new ConicalGradient(new Stop(0.0, Color.TRANSPARENT),
                                          new Stop(1.0, Color.TRANSPARENT));

        valueBlendBottomShadow = new DropShadow();
        valueBlendBottomShadow.setBlurType(BlurType.TWO_PASS_BOX);
        valueBlendBottomShadow.setColor(Color.rgb(255, 255, 255, 0.5));
        valueBlendBottomShadow.setOffsetX(0);
        valueBlendBottomShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
        valueBlendBottomShadow.setRadius(0);

        valueBlendTopShadow = new InnerShadow();
        valueBlendTopShadow.setBlurType(BlurType.TWO_PASS_BOX);
        valueBlendTopShadow.setColor(Color.rgb(0, 0, 0, 0.7));
        valueBlendTopShadow.setOffsetX(0);
        valueBlendTopShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
        valueBlendTopShadow.setRadius(0.005 * PREFERRED_WIDTH);

        blend = new Blend();
        blend.setMode(BlendMode.MULTIPLY);
        blend.setBottomInput(valueBlendBottomShadow);
        blend.setTopInput(valueBlendTopShadow);

        background = new Region();
        background.getStyleClass().setAll("background");

        ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();

        minMeasuredValue = new Region();
        minMeasuredValue.getStyleClass().setAll("min-measured-value");
        minMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
        minMeasuredValue.getTransforms().setAll(minMeasuredValueRotate);
        minMeasuredValue.setOpacity(getSkinnable().isMinMeasuredValueVisible() ? 1 : 0);
        minMeasuredValue.setManaged(getSkinnable().isMinMeasuredValueVisible());

        maxMeasuredValue = new Region();
        maxMeasuredValue.getStyleClass().setAll("max-measured-value");
        maxMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
        maxMeasuredValue.getTransforms().setAll(maxMeasuredValueRotate);
        maxMeasuredValue.setOpacity(getSkinnable().isMaxMeasuredValueVisible() ? 1 : 0);
        maxMeasuredValue.setManaged(getSkinnable().isMaxMeasuredValueVisible());

        threshold = new Region();
        threshold.getStyleClass().setAll("threshold");
        thresholdRotate = new Rotate(180 - getSkinnable().getStartAngle());
        threshold.getTransforms().setAll(thresholdRotate);
        threshold.setOpacity(getSkinnable().isThresholdVisible() ? 1 : 0);
        threshold.setManaged(getSkinnable().isThresholdVisible());
        thresholdExceeded = false;

        bar = new Arc();
        bar.setType(ArcType.ROUND);
        bar.setCenterX(PREFERRED_WIDTH * 0.5);
        bar.setCenterY(PREFERRED_HEIGHT * 0.5);
        bar.setRadiusX(PREFERRED_WIDTH * 0.5 - 4);
        bar.setRadiusY(PREFERRED_HEIGHT * 0.5 - 4);
        bar.setStartAngle(getSkinnable().getStartAngle() - 90);
        bar.setLength(0);
        bar.setStrokeType(StrokeType.CENTERED);
        bar.setStroke(null);
        bar.setFill(new RadialGradient(0, 0,
                                       PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                                       PREFERRED_WIDTH * 0.45, false, CycleMethod.NO_CYCLE,
                                       new Stop(0.0, barColor),
                                       new Stop(0.76, barColor.deriveColor(-5, 1, 1, 1)), // -5 for on the barColorHue)
                                       new Stop(0.79, barColor),
                                       new Stop(0.97, barColor),
                                       new Stop(1.0, barColor.deriveColor(-5, 1, 1, 1)))); // -5 for on the barColorHue)

        knob = new Region();
        knob.setPickOnBounds(false);
        knob.getStyleClass().setAll("knob");

View Full Code Here

            if (fraction > maxFraction) {
                maxFraction      = fraction;
                maxFractionColor = stop.getColor();
            }
        }
        stops.add(new Stop(0d, minFractionColor));
        stops.add(new Stop(0d + emptyOffset, minFractionColor));
        stops.add(new Stop(1d - emptyOffset, maxFractionColor));
        stops.add(new Stop(1d, maxFractionColor));
        if (getSkinnable().getBarGradient().size() == 2) {
            stops.add(new Stop((maxFraction - minFraction) * 0.5, (Color) Interpolator.LINEAR.interpolate(minFractionColor, maxFractionColor, 0.5)));
        }
        for (Stop stop : getSkinnable().getBarGradient()) {
            if (Double.compare(stop.getOffset(), minFraction) == 0 || Double.compare(stop.getOffset(), maxFraction) == 0) continue;
            stops.add(stop);
        }
View Full Code Here

                bar.setFill(new ImagePattern(image, 0, 0, size, size, false));
            } else {
                bar.setFill(new RadialGradient(0, 0,
                                               centerX, centerY,
                                               RADIUS, false, CycleMethod.NO_CYCLE,
                                               new Stop(0.0, barColor),
                                               new Stop(0.76, barColor.deriveColor(-5, 1, 1, 1)), // -5 for on the barColorHue)
                                               new Stop(0.79, barColor),
                                               new Stop(0.97, barColor),
                                               new Stop(1.0, barColor.deriveColor(-5, 1, 1, 1)))); // -5 for on the barColorHue)
            }
            knob.setPrefSize(size * 0.75, size * 0.75);
            knob.setTranslateX((size - knob.getPrefWidth()) * 0.5);
            knob.setTranslateY((size - knob.getPrefHeight()) * 0.5);
   
View Full Code Here

        this.paint = paint;
        if (paint instanceof Color) {
            setColor((Color) paint);
        } else if (paint instanceof GradientPaint) {
            GradientPaint gp = (GradientPaint) paint;
            Stop[] stops = new Stop[] { new Stop(0,
                    awtColorToJavaFX(gp.getColor1())),
                    new Stop(1, awtColorToJavaFX(gp.getColor2())) };
            Point2D p1 = gp.getPoint1();
            Point2D p2 = gp.getPoint2();
            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]));
            }

            if (paint instanceof RadialGradientPaint) {
                RadialGradientPaint rgp = (RadialGradientPaint) paint;
                Point2D center = rgp.getCenterPoint();
View Full Code Here

  @Override
  protected Scene createFxScene() {
    Group root = new Group();
    Scene scene = new Scene(root, 800, 600, Color.BLACK);
    Rectangle colors = new Rectangle(scene.getWidth(), scene.getHeight(), new LinearGradient(0f, 1f, 1f, 0f, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#f8bd55")), new Stop(0.14, Color.web("#c0fe56")), new Stop(0.28, Color.web("#5dfbc1")),
        new Stop(0.43, Color.web("#64c2f8")), new Stop(0.57, Color.web("#be4af7")), new Stop(0.71, Color.web("#ed5fc2")), new Stop(0.85, Color.web("#ef504c")), new Stop(1, Color.web("#f2660f")), }));

    Group circles = new Group();
    for (int i = 0; i < 30; i++) {
      Circle circle = new Circle(150, Color.web("white", 0.05));
      circle.setStrokeType(StrokeType.OUTSIDE);
View Full Code Here

    Scene scene = new Scene(root, 800, 600, Color.BLACK);
    primaryStage.setScene(scene);

    Rectangle colors = new Rectangle(scene.getWidth(), scene.getHeight(),
        new LinearGradient(0f, 1f, 1f, 0f, true, CycleMethod.NO_CYCLE,
            new Stop[] { new Stop(0, Color.web("#f8bd55")),
                new Stop(0.14, Color.web("#c0fe56")),
                new Stop(0.28, Color.web("#5dfbc1")),
                new Stop(0.43, Color.web("#64c2f8")),
                new Stop(0.57, Color.web("#be4af7")),
                new Stop(0.71, Color.web("#ed5fc2")),
                new Stop(0.85, Color.web("#ef504c")),
                new Stop(1, Color.web("#f2660f")), }));

    Group circles = new Group();
    for (int i = 0; i < 30; i++) {
      Circle circle = new Circle(150, Color.web("white", 0.05));
      circle.setStrokeType(StrokeType.OUTSIDE);
View Full Code Here

TOP

Related Classes of javafx.scene.paint.Stop

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.