Package javafx.scene.paint

Examples of javafx.scene.paint.Stop


        Pane pane = new Pane(dayBox, dateBox, monthBox, clockBox);
        pane.setPadding(new Insets(10, 10, 10, 10));

        Scene scene = new Scene(pane, 1280, 800, new LinearGradient(0, 0, 0, 800, false, CycleMethod.NO_CYCLE,
                                                                    new Stop(0.0, Color.rgb(28, 27, 22)),
                                                                    new Stop(0.25, Color.rgb(38, 37, 32)),
                                                                    new Stop(1.0, Color.rgb(28, 27, 22))));
        stage.setScene(scene);
        stage.show();

        timer.start();
    }
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

    public AngleConicalGradient(final Point2D CENTER, final double OFFSET_ANGLE, final Map<Double, Color> ANGLE_STOP_MAP) {
        final double ANGLE_FACTOR = 1d / 360d;
        double offset = Util.clamp(0d, 1d, (OFFSET_ANGLE % 360) * ANGLE_FACTOR);
        List<Stop> stops = new LinkedList<>();
        for (Double fraction : ANGLE_STOP_MAP.keySet()) {
            stops.add(new Stop(Util.clamp(0d, 1d, (fraction % 360) * ANGLE_FACTOR), ANGLE_STOP_MAP.get(fraction)));
        }
        gradient = new ConicalGradient(CENTER, offset, stops);
    }
View Full Code Here

        double offset = Util.clamp(0d, 1d, OFFSET);
        center = CENTER;
        List<Stop> stops;
        if (null == STOPS || STOPS.isEmpty()) {
            stops = new ArrayList<>();
            stops.add(new Stop(0.0, Color.TRANSPARENT));
            stops.add(new Stop(1.0, Color.TRANSPARENT));
        } else {
            stops = STOPS;
        }

        HashMap<Double, Color> stopMap = new LinkedHashMap<>(stops.size());
        for (Stop stop : stops) {
            stopMap.put(stop.getOffset(), stop.getColor());
        }

        sortedStops = new LinkedList<>();
        final SortedSet<Double> sortedFractions = new TreeSet<>(stopMap.keySet());
        if (sortedFractions.last() < 1) {
            stopMap.put(1.0, stopMap.get(sortedFractions.first()));
            sortedFractions.add(1.0);
        }
        if (sortedFractions.first() > 0) {
            stopMap.put(0.0, stopMap.get(sortedFractions.last()));
            sortedFractions.add(0.0);
        }
        for (final Double FRACTION : sortedFractions) {
            sortedStops.add(new Stop(FRACTION, stopMap.get(FRACTION)));
        }
        if (offset > 0) {
            recalculate(offset);
        }
    }
View Full Code Here

        List<Stop> stops = new ArrayList<>(sortedStops.size());
        for (Stop stop : sortedStops) {
            double newOffset = (stop.getOffset() + OFFSET) % 1;
            if(Double.compare(newOffset, 0d) == 0) {
                newOffset = 1.0;
                stops.add(new Stop(0.000001, stop.getColor()));
            } else if (stop.getOffset() + OFFSET > 1d) {
                newOffset -= 0.000001;
            }
            stops.add(new Stop(newOffset, stop.getColor()));
        }

        HashMap<Double, Color> stopMap = new LinkedHashMap<>(stops.size());
        for (Stop stop : stops) {
            stopMap.put(stop.getOffset(), stop.getColor());
        }

        List<Stop> sortedStops2 = new LinkedList<>();
        SortedSet<Double> sortedFractions = new TreeSet<>(stopMap.keySet());
        if (sortedFractions.last() < 1) {
            stopMap.put(1.0, stopMap.get(sortedFractions.first()));
            sortedFractions.add(1.0);
        }
        if (sortedFractions.first() > 0) {
            stopMap.put(0.0, stopMap.get(sortedFractions.last()));
            sortedFractions.add(0.0);
        }
        for (Double fraction : sortedFractions) {
            sortedStops2.add(new Stop(fraction, stopMap.get(fraction)));
        }
        sortedStops.clear();
        sortedStops.addAll(sortedStops2);
    }
View Full Code Here

        if (isFrameVisible()) { //frame
            Paint frame = new LinearGradient(0.14 * size, 0.14 * size,
                                             0.84 * size, 0.84 * size,
                                             false, CycleMethod.NO_CYCLE,
                                             new Stop(0.0, Color.rgb(20, 20, 20, 0.65)),
                                             new Stop(0.15, Color.rgb(20, 20, 20, 0.65)),
                                             new Stop(0.26, Color.rgb(41, 41, 41, 0.65)),
                                             new Stop(0.26, Color.rgb(41, 41, 41, 0.64)),
                                             new Stop(0.85, Color.rgb(200, 200, 200, 0.41)),
                                             new Stop(1.0, Color.rgb(200, 200, 200, 0.35)));
            ctx.setFill(frame);
            ctx.fillOval(0, 0, size, size);
        }

        InnerShadow innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0);
        if (isOn()) { //on
            ctx.save();
            Paint on = new LinearGradient(0.25 * size, 0.25 * size,
                                          0.74 * size, 0.74 * size,
                                          false, CycleMethod.NO_CYCLE,
                                          new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.77, 1d)),
                                          new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.5, 1d)),
                                          new Stop(1.0, ledColor.get()));
            innerShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, ledColor.get(), 0.36 * size, 0, 0, 0));
            ctx.setEffect(innerShadow);
            ctx.setFill(on);
            ctx.fillOval(0.14 * size, 0.14 * size, 0.72 * size, 0.72 * size);
            ctx.restore();
        } else { // off
            ctx.save();
            Paint off = new LinearGradient(0.25 * size, 0.25 * size,
                                           0.74 * size, 0.74 * size,
                                           false, CycleMethod.NO_CYCLE,
                                           new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.20, 1d)),
                                           new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.13, 1d)),
                                           new Stop(1.0, ledColor.get().deriveColor(0d, 1d, 0.2, 1d)));
            ctx.setEffect(innerShadow);
            ctx.setFill(off);
            ctx.fillOval(0.14 * size, 0.14 * size, 0.72 * size, 0.72 * size);
            ctx.restore();
        }

        //highlight
        Paint highlight = new RadialGradient(0, 0,
                                             0.3 * size, 0.3 * size,
                                             0.29 * size,
                                             false, CycleMethod.NO_CYCLE,
                                             new Stop(0.0, Color.WHITE),
                                             new Stop(1.0, Color.TRANSPARENT));
        ctx.setFill(highlight);
        ctx.fillOval(0.21 * size, 0.21 * size, 0.58 * size, 0.58 * size);
    }
View Full Code Here

    // ******************** Constructors **************************************
    public HeatControlSkin(HeatControl heatControl) {
        super(heatControl);
        userAction        = false;
        newTarget         = "";
        gradientLookup    = new GradientLookup(new Stop(0.10, Color.web("#3221c9")),                                              
                                               new Stop(0.20, Color.web("#216ec9")),
                                               new Stop(0.30, Color.web("#21bac9")),
                                               new Stop(0.40, Color.web("#30cb22")),
                                               new Stop(0.50, Color.web("#2fcb22")),
                                               new Stop(0.60, Color.web("#f1ec28")),
                                               new Stop(0.70, Color.web("#f1c428")),
                                               new Stop(0.80, Color.web("#f19c28")),
                                               new Stop(0.90, Color.web("#f16f28")),
                                               new Stop(1.00, Color.web("#ec272f")));       
        angleStep         = heatControl.getAngleRange() / (heatControl.getMaxValue() - heatControl.getMinValue());
        mouseEventHandler = mouseEvent -> handleMouseEvent(mouseEvent);
        touchEventHandler = touchEvent -> handleTouchEvent(touchEvent);

        init();
View Full Code Here

        innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_HEIGHT * 0.1, 0, 0, 0);
        Color color = gradientLookup.getColorAt(getSkinnable().getValue() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue()));
        background = new Circle(0.5 * PREFERRED_WIDTH, 0.5 * PREFERRED_HEIGHT, 0.5 * PREFERRED_WIDTH);
        background.setFill(new LinearGradient(0, 0, 0, PREFERRED_HEIGHT,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0, color.deriveColor(0, 1, 0.8, 1)),
                                              new Stop(1, color.deriveColor(0, 1, 0.6, 1))));
        background.setEffect(innerShadow);

        ticksCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        ticksCanvas.setMouseTransparent(true);
        ticks = ticksCanvas.getGraphicsContext2D();
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.