Search in sources :

Example 6 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class LedOne method recalc.

// ******************** Resize/Redraw *************************************
private void recalc() {
    width = getWidth();
    height = getHeight();
    if (width <= 0 || height <= 0)
        return;
    size = width < height ? width : height;
    offsetX = 0;
    offsetY = 0;
    if (width > height) {
        offsetX = 0.5 * (width - size);
    } else if (height > width) {
        offsetY = 0.5 * (height - size);
    }
    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)));
    highlightGradient = new RadialGradient(0, 0, offsetX + 0.3 * size, offsetY + 0.3 * size, 0.29 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.WHITE), new Stop(1.0, Color.TRANSPARENT));
    draw();
}
Also used : LinearGradient(javafx.scene.paint.LinearGradient) InnerShadow(javafx.scene.effect.InnerShadow) Stop(javafx.scene.paint.Stop) RadialGradient(javafx.scene.paint.RadialGradient) DropShadow(javafx.scene.effect.DropShadow)

Example 7 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class Led method recalc.

// ******************** Resize/Redraw *************************************
private void recalc() {
    double size = getWidth() < getHeight() ? getWidth() : getHeight();
    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)));
    highlightGradient = 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));
    draw();
}
Also used : LinearGradient(javafx.scene.paint.LinearGradient) InnerShadow(javafx.scene.effect.InnerShadow) Stop(javafx.scene.paint.Stop) RadialGradient(javafx.scene.paint.RadialGradient) DropShadow(javafx.scene.effect.DropShadow)

Example 8 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class RectangularGaugeSkin method initGraphics.

private void initGraphics() {
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d);
    glow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getLedColor(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    ledFrame = new Region();
    ledFrame.getStyleClass().setAll("led-frame");
    ledMain = new Region();
    ledMain.getStyleClass().setAll("led-main");
    ledMain.setStyle("-led-color: " + (colorToCss(getSkinnable().getLedColor())) + ";");
    ledHl = new Region();
    ledHl.getStyleClass().setAll("led-hl");
    needle = new Region();
    needle.getStyleClass().setAll(RectangularGauge.STYLE_CLASS_NEEDLE_STANDARD);
    needleRotate = new Rotate(180 - getSkinnable().getStartAngle());
    needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - oldValue - getSkinnable().getMinValue()) * angleStep);
    needle.getTransforms().setAll(needleRotate);
    needleHighlight = new Region();
    needleHighlight.setMouseTransparent(true);
    needleHighlight.getStyleClass().setAll("needle-highlight");
    needleHighlight.getTransforms().setAll(needleRotate);
    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
    shadowGroup = new Group(needle, needleHighlight);
    shadowGroup.setEffect(getSkinnable().isDropShadowEnabled() ? dropShadow : null);
    titleText = new Text(getSkinnable().getTitle());
    titleText.setTextOrigin(VPos.CENTER);
    titleText.getStyleClass().setAll("title");
    unitText = new Text(getSkinnable().getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.getStyleClass().setAll("unit");
    lcdText = new Label(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    lcdText.getStyleClass().setAll("lcd-text");
    // Set initial value
    angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double targetAngle = 180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep;
    targetAngle = clamp(180 - getSkinnable().getStartAngle(), 180 - getSkinnable().getStartAngle() + getSkinnable().getAngleRange(), targetAngle);
    needleRotate.setAngle(targetAngle);
    lightEffect = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.65), 2, 0d, 0d, 2d);
    foreground = new Region();
    foreground.getStyleClass().setAll("foreground");
    foreground.setEffect(lightEffect);
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(ticksAndSectionsCanvas, ledFrame, ledMain, ledHl, unitText, lcdText, shadowGroup, foreground, titleText);
    getChildren().setAll(pane);
}
Also used : Group(javafx.scene.Group) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Canvas(javafx.scene.canvas.Canvas) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 9 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class HeatControlSkin method initGraphics.

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);
    ticksCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksCanvas.setMouseTransparent(true);
    ticks = ticksCanvas.getGraphicsContext2D();
    targetIndicator = new Region();
    targetIndicator.getStyleClass().setAll("target-indicator");
    targetIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle() - getSkinnable().getMinValue() * angleStep);
    targetIndicator.getTransforms().setAll(targetIndicatorRotate);
    targetExceeded = false;
    targetIndicator.setVisible(getSkinnable().isTargetEnabled());
    valueIndicator = new Region();
    valueIndicator.getStyleClass().setAll("value-indicator");
    valueIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle());
    valueIndicatorRotate.setAngle(valueIndicatorRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() - getSkinnable().getMinValue()) * angleStep);
    valueIndicator.getTransforms().setAll(valueIndicatorRotate);
    infoText = new Text(getSkinnable().getInfoText().toUpperCase());
    infoText.setTextOrigin(VPos.CENTER);
    infoText.setFont(Fonts.robotoMedium(0.06 * PREFERRED_HEIGHT));
    infoText.setMouseTransparent(true);
    infoText.getStyleClass().setAll("info-text");
    value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    value.setMouseTransparent(true);
    value.setTextOrigin(VPos.CENTER);
    value.setFont(Fonts.robotoBold(0.32 * PREFERRED_HEIGHT));
    value.setMouseTransparent(true);
    value.getStyleClass().setAll("value");
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(background, ticksCanvas, valueIndicator, targetIndicator, infoText, value);
    getChildren().setAll(pane);
}
Also used : Circle(javafx.scene.shape.Circle) LinearGradient(javafx.scene.paint.LinearGradient) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Stop(javafx.scene.paint.Stop) Color(javafx.scene.paint.Color) Canvas(javafx.scene.canvas.Canvas) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane)

Example 10 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class LcdClockSkin method initGraphics.

private void initGraphics() {
    main = new Region();
    main.getStyleClass().setAll("main");
    main.setOpacity(getSkinnable().isBackgroundVisible() ? 1 : 0);
    mainInnerShadow0 = new InnerShadow();
    mainInnerShadow0.setOffsetX(0.0);
    mainInnerShadow0.setOffsetY(0.0);
    mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH);
    mainInnerShadow0.setColor(Color.web("0xffffff80"));
    mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX);
    mainInnerShadow1 = new InnerShadow();
    mainInnerShadow1.setOffsetX(0.0);
    mainInnerShadow1.setOffsetY(1.0);
    mainInnerShadow1.setRadius(2.0 / 132.0 * PREFERRED_WIDTH);
    mainInnerShadow1.setColor(Color.web("0x000000a6"));
    mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    mainInnerShadow1.setInput(mainInnerShadow0);
    main.setEffect(getSkinnable().isMainInnerShadowVisible() ? mainInnerShadow1 : null);
    crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT);
    crystalClip.setArcWidth(5);
    crystalClip.setArcHeight(5);
    crystalImage = createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8);
    crystalOverlay = new ImageView(crystalImage);
    crystalOverlay.setClip(this.crystalClip);
    crystalOverlay.setOpacity(getSkinnable().isCrystalOverlayVisible() ? 1 : 0);
    alarm = new Region();
    alarm.getStyleClass().setAll("alarm");
    alarm.setOpacity(getSkinnable().getAlarms().isEmpty() || allAlarmsInactive() ? 0 : 1);
    backgroundTimeText = new Text("");
    backgroundTimeText.getStyleClass().setAll("fg-trsp");
    backgroundTimeText.setOpacity((LcdClock.LcdFont.LCD == getSkinnable().getTimeFont() || LcdClock.LcdFont.ELEKTRA == getSkinnable().getTimeFont()) ? 1 : 0);
    timeText = new Text("");
    timeText.getStyleClass().setAll("fg");
    backgroundSecondText = new Text("");
    backgroundSecondText.getStyleClass().setAll("fg-trsp");
    backgroundSecondText.setOpacity((LcdClock.LcdFont.LCD == getSkinnable().getTimeFont() || LcdClock.LcdFont.ELEKTRA == getSkinnable().getTimeFont()) ? 1 : 0);
    secondText = new Text("");
    secondText.getStyleClass().setAll("fg");
    title = new Text(getSkinnable().getTitle());
    title.getStyleClass().setAll("fg");
    dateText = new Text(getSkinnable().getTime().getMonthValue() + "/" + getSkinnable().getTime().getDayOfMonth() + "/" + getSkinnable().getTime().getYear());
    dateText.getStyleClass().setAll("fg");
    dayOfWeekText = new Text("");
    dayOfWeekText.getStyleClass().setAll("fg");
    shadowGroup = new Group();
    shadowGroup.setEffect(getSkinnable().isForegroundShadowVisible() ? FOREGROUND_SHADOW : null);
    shadowGroup.getChildren().setAll(alarm, timeText, secondText, title, dateText, dayOfWeekText);
    pane = new Pane();
    pane.getChildren().setAll(main, crystalOverlay, backgroundTimeText, backgroundSecondText, shadowGroup);
    getChildren().setAll(pane);
    resize();
    updateLcd();
}
Also used : Group(javafx.scene.Group) InnerShadow(javafx.scene.effect.InnerShadow) Rectangle(javafx.scene.shape.Rectangle) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) ImageView(javafx.scene.image.ImageView) Pane(javafx.scene.layout.Pane)

Aggregations

InnerShadow (javafx.scene.effect.InnerShadow)23 DropShadow (javafx.scene.effect.DropShadow)17 Region (javafx.scene.layout.Region)17 Pane (javafx.scene.layout.Pane)13 Text (javafx.scene.text.Text)13 Canvas (javafx.scene.canvas.Canvas)9 Group (javafx.scene.Group)8 Rotate (javafx.scene.transform.Rotate)7 Stop (javafx.scene.paint.Stop)6 LinearGradient (javafx.scene.paint.LinearGradient)5 Color (javafx.scene.paint.Color)4 RadialGradient (javafx.scene.paint.RadialGradient)4 Label (javafx.scene.control.Label)3 Path (javafx.scene.shape.Path)3 Rectangle (javafx.scene.shape.Rectangle)3 Blend (javafx.scene.effect.Blend)2 ImageView (javafx.scene.image.ImageView)2 Arc (javafx.scene.shape.Arc)2 Circle (javafx.scene.shape.Circle)2 LineTo (javafx.scene.shape.LineTo)2