Package javafx.scene.paint

Examples of javafx.scene.paint.LinearGradient


        //font = Font.font("Bebas Neue", PREFERRED_HEIGHT);
        //font = Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/bebasneue.otf"), PREFERRED_HEIGHT);
        font = Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/droidsansmono.ttf"), PREFERRED_HEIGHT);

        upperTextFill = new LinearGradient(0, 0,
                                           0, flapHeight,
                                           false, CycleMethod.NO_CYCLE,
                                           new Stop(0.0, getSkinnable().getTextColor()),
                                           new Stop(1.0, getSkinnable().getTextColor().darker()));
        upperBackgroundText    = new Canvas();
        ctxUpperBackgroundText = upperBackgroundText.getGraphicsContext2D();
        ctxUpperBackgroundText.setTextBaseline(VPos.CENTER);
        ctxUpperBackgroundText.setTextAlign(TextAlignment.CENTER);

        lowerBackground = new Region();
        lowerBackground.setEffect(innerHighlight);

        lowerTextFill = new LinearGradient(0, 0.5079365079365079 * PREFERRED_HEIGHT,
                                           0, 0.5079365079365079 * PREFERRED_HEIGHT + flapHeight,
                                           false, CycleMethod.NO_CYCLE,
                                           new Stop(0.0, getSkinnable().getTextColor().darker()),
                                           new Stop(1.0, getSkinnable().getTextColor()));
        lowerBackgroundText    = new Canvas();
View Full Code Here


    private void refreshTextCtx() {
        double flapWidth  = flapTextFront.getWidth();
        double flapHeight = flapTextFront.getHeight();

        upperTextFill = new LinearGradient(0, 0,
                                           0, flapHeight,
                                           false, CycleMethod.NO_CYCLE,
                                           new Stop(0.0, getSkinnable().getTextColor().brighter().brighter()),
                                           new Stop(0.99, getSkinnable().getTextColor()),
                                           new Stop(1.0, getSkinnable().getTextColor().darker()));

        lowerTextFill = new LinearGradient(0, 0,
                                           0, flapHeight,
                                           false, CycleMethod.NO_CYCLE,
                                           new Stop(0.0, getSkinnable().getTextColor().brighter().brighter()),
                                           new Stop(0.01, getSkinnable().getTextColor().brighter()),
                                           new Stop(1.0, getSkinnable().getTextColor()));

        // set the text on the upper background
        ctxUpperBackgroundText.clearRect(0, 0, flapWidth, flapHeight);
        ctxUpperBackgroundText.setFill(upperTextFill);
        //ctxUpperBackgroundText.fillText(selectedSet.get(nextSelectionIndex), width * 0.5, height * 0.55);
        ctxUpperBackgroundText.fillText(selectedSet.get(nextSelectionIndex), width * 0.5, height * 0.5);

        // set the text on the lower background
        ctxLowerBackgroundText.clearRect(0, 0, flapWidth, flapHeight);
        ctxLowerBackgroundText.setFill(lowerTextFill);
        //ctxLowerBackgroundText.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, height * 0.041);
        ctxLowerBackgroundText.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, 0);

        // set the text on the flap front
        ctxTextFront.clearRect(0, 0, flapWidth, flapHeight);
        ctxTextFront.setFill(upperTextFill);
        //ctxTextFront.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, height * 0.55);
        ctxTextFront.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, height * 0.5);

        // set the text on the flap back
        ctxTextBack.clearRect(0, 0, flapWidth, flapHeight);
        ctxTextBack.setFill(new LinearGradient(0, 0,
                                               0, -flapHeight,
                                               false, CycleMethod.NO_CYCLE,
                                               new Stop(0.0, getSkinnable().getTextColor().brighter().brighter()),
                                               new Stop(0.99, getSkinnable().getTextColor().brighter()),
                                               new Stop(1.0, getSkinnable().getTextColor())));
View Full Code Here

        // RULB
        CTX.beginPath();
        CTX.rect(0, 0, WIDTH * 0.5, HEIGHT * 0.5);
        CTX.closePath();

        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.5 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(35, 35, 35)),
                                       new Stop(1, Color.rgb(23, 23, 23))));
        CTX.fill();

        // RULF
        CTX.beginPath();
        CTX.rect(WIDTH * 0.083333, 0, WIDTH * 0.333333, HEIGHT * 0.416666);
        CTX.closePath();
        offsetY = 0;
        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.416666 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(38, 38, 38)),
                                       new Stop(1, Color.rgb(30, 30, 30))));
        CTX.fill();

        // RLRB
        CTX.beginPath();
        CTX.rect(WIDTH * 0.5, HEIGHT * 0.5, WIDTH * 0.5, HEIGHT * 0.5);
        CTX.closePath();
        offsetY = 0.5;
        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.5 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(35, 35, 35)),
                                       new Stop(1, Color.rgb(23, 23, 23))));
        CTX.fill();

        // RLRF
        CTX.beginPath();
        CTX.rect(WIDTH * 0.583333, HEIGHT * 0.5, WIDTH * 0.333333, HEIGHT * 0.416666);
        CTX.closePath();
        offsetY = 0.5;
        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.416666 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(38, 38, 38)),
                                       new Stop(1, Color.rgb(30, 30, 30))));
        CTX.fill();

        // RURB
        CTX.beginPath();
        CTX.rect(WIDTH * 0.5, 0, WIDTH * 0.5, HEIGHT * 0.5);
        CTX.closePath();
        offsetY = 0;
        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.5 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(48, 48, 48)),
                                       new Stop(1, Color.rgb(40, 40, 40))));
        CTX.fill();

        // RURF
        CTX.beginPath();
        CTX.rect(WIDTH * 0.583333, HEIGHT * 0.083333, WIDTH * 0.333333, HEIGHT * 0.416666);
        CTX.closePath();
        offsetY = 0.083333;
        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.416666 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(53, 53, 53)),
                                       new Stop(1, Color.rgb(45, 45, 45))));
        CTX.fill();

        // RLLB
        CTX.beginPath();
        CTX.rect(0, HEIGHT * 0.5, WIDTH * 0.5, HEIGHT * 0.5);
        CTX.closePath();
        offsetY = 0.5;
        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.5 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(48, 48, 48)),
                                       new Stop(1, Color.rgb(40, 40, 40))));
        CTX.fill();

        // RLLF
        CTX.beginPath();
        CTX.rect(WIDTH * 0.083333, HEIGHT * 0.583333, WIDTH * 0.333333, HEIGHT * 0.416666);
        CTX.closePath();
        offsetY = 0.583333;
        CTX.setFill(new LinearGradient(0, offsetY * HEIGHT,
                                       0, 0.416666 * HEIGHT + offsetY * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(53, 53, 53)),
                                       new Stop(1, Color.rgb(45, 45, 45))));
        CTX.fill();
View Full Code Here

        CTX.bezierCurveTo(0, HEIGHT * 0.4, WIDTH * 0.066666, HEIGHT * 0.466666, WIDTH * 0.2, HEIGHT * 0.466666);
        CTX.bezierCurveTo(WIDTH * 0.333333, HEIGHT * 0.466666, WIDTH * 0.4, HEIGHT * 0.4, WIDTH * 0.4, HEIGHT * 0.266666);
        CTX.bezierCurveTo(WIDTH * 0.4, HEIGHT * 0.133333, WIDTH * 0.333333, HEIGHT * 0.066666, WIDTH * 0.2, HEIGHT * 0.066666);
        CTX.bezierCurveTo(WIDTH * 0.066666, HEIGHT * 0.066666, 0, HEIGHT * 0.133333, 0, HEIGHT * 0.266666);
        CTX.closePath();
        CTX.setFill(new LinearGradient(0, 0.066666 * HEIGHT,
                                       0, 0.466666 * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(0, 0, 0)),
                                       new Stop(1, Color.rgb(68, 68, 68))));
        CTX.fill();

        // ULF
        CTX.beginPath();
        CTX.moveTo(0, HEIGHT * 0.2);
        CTX.bezierCurveTo(0, HEIGHT * 0.333333, WIDTH * 0.066666, HEIGHT * 0.4, WIDTH * 0.2, HEIGHT * 0.4);
        CTX.bezierCurveTo(WIDTH * 0.333333, HEIGHT * 0.4, WIDTH * 0.4, HEIGHT * 0.333333, WIDTH * 0.4, HEIGHT * 0.2);
        CTX.bezierCurveTo(WIDTH * 0.4, HEIGHT * 0.066666, WIDTH * 0.333333, 0, WIDTH * 0.2, 0);
        CTX.bezierCurveTo(WIDTH * 0.066666, 0, 0, HEIGHT * 0.066666, 0, HEIGHT * 0.2);
        CTX.closePath();
        CTX.setFill(TEXTURE_COLOR.darker().darker());
        CTX.fill();

        // LRB
        CTX.beginPath();
        CTX.moveTo(WIDTH * 0.466666, HEIGHT * 0.733333);
        CTX.bezierCurveTo(WIDTH * 0.466666, HEIGHT * 0.866666, WIDTH * 0.533333, HEIGHT * 0.933333, WIDTH * 0.666666, HEIGHT * 0.933333);
        CTX.bezierCurveTo(WIDTH * 0.8, HEIGHT * 0.933333, WIDTH * 0.866666, HEIGHT * 0.866666, WIDTH * 0.866666, HEIGHT * 0.733333);
        CTX.bezierCurveTo(WIDTH * 0.866666, HEIGHT * 0.6, WIDTH * 0.8, HEIGHT * 0.533333, WIDTH * 0.666666, HEIGHT * 0.533333);
        CTX.bezierCurveTo(WIDTH * 0.533333, HEIGHT * 0.533333, WIDTH * 0.466666, HEIGHT * 0.6, WIDTH * 0.466666, HEIGHT * 0.733333);
        CTX.closePath();
        CTX.setFill(new LinearGradient(0, 0.533333 * HEIGHT,
                                       0, 0.933333 * HEIGHT,
                                       false, CycleMethod.NO_CYCLE,
                                       new Stop(0, Color.rgb(0, 0, 0)),
                                       new Stop(1, Color.rgb(68, 68, 68))));
        CTX.fill();
View Full Code Here

                        new Stop(1f, Color.color(
                                (endColor4.getRed() - startColor4.getRed()) * newValue.doubleValue() + startColor4.getRed(),
                                (endColor4.getGreen() - startColor4.getGreen()) * newValue.doubleValue() + startColor4.getGreen(),
                                (endColor4.getBlue() - startColor4.getBlue()) * newValue.doubleValue() + startColor4.getBlue()))};
                       
                        LinearGradient gradient = new LinearGradient(0.0, 0.0, 0.0, 1.0, true, CycleMethod.NO_CYCLE, stops);
                        BackgroundFill backkgroudFill = new BackgroundFill(gradient, new CornerRadii(4.0), new Insets(0));
                        list.add(backkgroudFill);

                        getSkinnable().setBackground(new Background(list.get(0)));
                    }
View Full Code Here

                        // the animated fill

                        Stop[] stops0 = new Stop[] { new Stop(0.0f, Color.rgb(176, 176, 176)), new Stop(1f, Color.rgb(207, 207,
                                207)) };
                        LinearGradient gradient0 = new LinearGradient(0.0, 0.0, 0.0, 1.0, true, CycleMethod.NO_CYCLE, stops0);
                        BackgroundFill backkgroudFill0 = new BackgroundFill(gradient0, new CornerRadii(2.0), new Insets(0));
                        list.add(backkgroudFill0);

                        Stop[] stops1 = new Stop[] { new Stop(0.5f, Color.rgb(84, 169, 239)), new Stop(0.5f, Color.rgb(236, 236,
                                236)) };
                        LinearGradient gradient1 = new LinearGradient(startX, 0.45, endX, 0.0, true, CycleMethod.REFLECT, stops1);
                        BackgroundFill backkgroudFill1 = new BackgroundFill(gradient1, new CornerRadii(2.0), new Insets(1));
                        list.add(backkgroudFill1);

                        Stop[] stops2 = new Stop[] { new Stop(0.05f, Color.rgb(255, 255, 255, 0.7)), new Stop(0.05f, Color.rgb(
                                255, 255, 255, 0.55)), new Stop(0.5f, Color.rgb(255, 255, 255, 0.1)), new Stop(0.5f, Color.rgb(
                                255, 255, 255, 0.0)), new Stop(0.6f, Color.rgb(255, 255, 255, 0.0)), new Stop(0.85f, Color.rgb(
                                255, 255, 255, 0.4)), new Stop(1f, Color.rgb(245, 245, 245, 0.7)) };
                        LinearGradient gradient2 = new LinearGradient(0.0, 0.0, 0.0, 1.0, true, CycleMethod.NO_CYCLE, stops2);
                        BackgroundFill backkgroudFill2 = new BackgroundFill(gradient2, new CornerRadii(2.0), new Insets(0));
                        list.add(backkgroudFill2);

                        getSkinnable().setBackground(new Background(list, null));
                    }
                });
                indeterminateProgressTransition.play();
            }
        } else {
            List<BackgroundFill> list = new ArrayList<>();

            Stop[] stops0 = new Stop[] { new Stop(0.0f, Color.rgb(176, 176, 176)), new Stop(1f, Color.rgb(207, 207, 207)) };
            LinearGradient gradient0 = new LinearGradient(0.0, 0.0, 0.0, 1.0, true, CycleMethod.NO_CYCLE, stops0);
            BackgroundFill backkgroudFill0 = new BackgroundFill(gradient0, new CornerRadii(2.0), new Insets(0));
            list.add(backkgroudFill0);

            Stop[] stops1 = new Stop[] { new Stop(0.5f, Color.rgb(84, 169, 239)), new Stop(0.5f, Color.rgb(236, 236, 236)) };
            LinearGradient gradient1 = new LinearGradient(0.0, 0.45, 0.05, 0.0, true, CycleMethod.REFLECT, stops1);
            BackgroundFill backkgroudFill1 = new BackgroundFill(gradient1, new CornerRadii(2.0), new Insets(1));
            list.add(backkgroudFill1);

            Stop[] stops2 = new Stop[] { new Stop(0.05f, Color.rgb(255, 255, 255, 0.7)), new Stop(0.05f, Color.rgb(255, 255, 255,
                    0.55)), new Stop(0.5f, Color.rgb(255, 255, 255, 0.1)), new Stop(0.5f, Color.rgb(255, 255, 255, 0.0)), new Stop(0.6f, Color.rgb(
                    255, 255, 255, 0.0)), new Stop(0.85f, Color.rgb(255, 255, 255, 0.4)), new Stop(1f, Color.rgb(245, 245, 245,
                    0.7)) };
            LinearGradient gradient2 = new LinearGradient(0.0, 0.0, 0.0, 1.0, true, CycleMethod.NO_CYCLE, stops2);
            BackgroundFill backkgroudFill2 = new BackgroundFill(gradient2, new CornerRadii(2.0), new Insets(0));
            list.add(backkgroudFill2);

            getSkinnable().setBackground(new Background(list, null));
        }
View Full Code Here

        drawTickMarks(ticks);
    }
  
    private void adjustBackgroundColor() {
        Color color = gradientLookup.getColorAt(getSkinnable().getValue() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue()));
        background.setFill(new LinearGradient(0, 0, 0, size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0, color.deriveColor(0, 1, 0.8, 1)),
                                              new Stop(1, color.deriveColor(0, 1, 0.6, 1))));                       
    }
View Full Code Here

        ledOffShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0);

        ledOnShadow  = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0);
        ledOnShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, ledColor.get(), 0.36 * size, 0, 0, 0));

        frameGradient = new LinearGradient(offsetX + 0.14 * size, offsetY + 0.14 * size,
                                           offsetX + 0.84 * size, offsetY + 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)));

        ledOnGradient = new LinearGradient(offsetX + 0.25 * size, offsetY + 0.25 * size,
                                           offsetX + 0.74 * size, offsetY + 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()));

        ledOffGradient = new LinearGradient(offsetX + 0.25 * size, offsetY + 0.25 * size,
                                            offsetX + 0.74 * size, offsetY + 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)));
View Full Code Here

        canvas.setHeight(size);

        ctx.clearRect(0, 0, size, size);

        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, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.77, 1d)),
                                          new Stop(0.49, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.5, 1d)),
                                          new Stop(1.0, ((Color)ledColor.get())));
            innerShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, (Color)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, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.20, 1d)),
                                           new Stop(0.49, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.13, 1d)),
                                           new Stop(1.0, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.2, 1d)));
View Full Code Here

        upperBackground = new Region();
        upperBackground.setEffect(innerHighlight);
       
        font = Fonts.bebasNeue(PREFERRED_HEIGHT);
       
        upperTextFill = new LinearGradient(0, 0,
                                           0, flapHeight,
                                           false, CycleMethod.NO_CYCLE,
                                           new Stop(0.0, getSkinnable().getTextColor()),
                                           new Stop(1.0, getSkinnable().getTextColor().darker()));
        upperBackgroundText    = new Canvas();
        ctxUpperBackgroundText = upperBackgroundText.getGraphicsContext2D();
        ctxUpperBackgroundText.setTextBaseline(VPos.CENTER);
        ctxUpperBackgroundText.setTextAlign(TextAlignment.CENTER);

        lowerBackground = new Region();
        lowerBackground.setEffect(innerHighlight);

        lowerTextFill = new LinearGradient(0, 0.5079365079365079 * PREFERRED_HEIGHT,
                                           0, 0.5079365079365079 * PREFERRED_HEIGHT + flapHeight,
                                           false, CycleMethod.NO_CYCLE,
                                           new Stop(0.0, getSkinnable().getTextColor().darker()),
                                           new Stop(1.0, getSkinnable().getTextColor()));
        lowerBackgroundText    = new Canvas();
View Full Code Here

TOP

Related Classes of javafx.scene.paint.LinearGradient

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.