Package javafx.scene.paint

Examples of javafx.scene.paint.LinearGradient


    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


        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(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)));

        ledOnGradient = 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()));

        ledOffGradient = 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)));
View Full Code Here

    private void initGraphics() {                       
        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);

View Full Code Here

        clockBox.setLayoutY(375);

        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))));
        scene.setCamera(new PerspectiveCamera());
       
View Full Code Here

            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();
                Point2D focus = rgp.getFocusPoint();          
                double focusDistance = focus.distance(center);
                double focusAngle = 0.0;
                if (!focus.equals(center)) {
                    focusAngle = Math.atan2(focus.getY() - center.getY(),
                        focus.getX() - center.getX());
                }
                double radius = rgp.getRadius();
                RadialGradient rg = new RadialGradient(
                        focusAngle * Math.PI / 180, focusDistance,
                        center.getX(), center.getY(), radius, false,
                        CycleMethod.NO_CYCLE, stops);
                this.gc.setStroke(rg);
                this.gc.setFill(rg);
            } else if (paint instanceof LinearGradientPaint) {
                LinearGradientPaint lgp = (LinearGradientPaint) paint;
                Point2D start = lgp.getStartPoint();
                Point2D end = lgp.getEndPoint();
                LinearGradient lg = new LinearGradient(start.getX(),
                        start.getY(), end.getX(), end.getY(), false,
                        CycleMethod.NO_CYCLE, stops);
                this.gc.setStroke(lg);
                this.gc.setFill(lg);
            }
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));
View Full Code Here

    Group root = new Group();
    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")),
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.