Java Code Examples for javafx.scene.effect.InnerShadow#setInput()
The following examples show how to use
javafx.scene.effect.InnerShadow#setInput() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignalTowerSkin.java From Enzo with Apache License 2.0 | 5 votes |
private void initGraphics() { green = new Region(); green.getStyleClass().setAll("green"); yellow = new Region(); yellow.getStyleClass().setAll("yellow"); red = new Region(); red.getStyleClass().setAll("red"); rack = new Region(); rack.getStyleClass().setAll("rack"); bodyDropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.web("0x000000a6"), 0.0133333333 * PREFERRED_WIDTH, 1.0, 0d, 2d); bodyInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.web("0x000000a6"), 0.0133333333 * PREFERRED_WIDTH, 1.0, 1.4142135623730951, 1.4142135623730951); bodyInnerShadow.setInput(bodyDropShadow); body = new Region(); body.getStyleClass().setAll("body"); body.setEffect(bodyInnerShadow); roof = new Region(); roof.getStyleClass().setAll("roof"); pane = new Pane(); pane.getChildren().setAll(green, yellow, red, rack, body, roof); getChildren().setAll(pane); resize(); }
Example 2
Source File: LedSkin.java From JFX8CustomControls with Apache License 2.0 | 5 votes |
private void initGraphics() { size = getSkinnable().getPrefWidth() < getSkinnable().getPrefHeight() ? getSkinnable().getPrefWidth() : getSkinnable().getPrefHeight(); frame = new Circle(0.5 * size, 0.5 * size, 0.5 * size); frame.setStroke(null); frame.setVisible(getSkinnable().isFrameVisible()); main = new Circle(0.5 * size, 0.5 * size, 0.36 * size); main.setStroke(null); innerShadow = new InnerShadow(); innerShadow.setRadius(0.090 * main.getLayoutBounds().getWidth()); innerShadow.setColor(Color.BLACK); innerShadow.setBlurType(BlurType.GAUSSIAN); innerShadow.setInput(null); glow = new DropShadow(); glow.setRadius(0.45 * main.getLayoutBounds().getWidth()); glow.setColor((Color) getSkinnable().getLedColor()); glow.setBlurType(BlurType.GAUSSIAN); glow.setInput(innerShadow); highlight = new Circle(0.5 * size, 0.5 * size, 0.29 * size); highlight.setStroke(null); getChildren().setAll(frame, main, highlight); }
Example 3
Source File: Led.java From JFX8CustomControls with Apache License 2.0 | 5 votes |
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(); }
Example 4
Source File: LcdSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } mainInnerShadow0 = new InnerShadow(); mainInnerShadow0.setOffsetX(0.0); mainInnerShadow0.setOffsetY(0.0); mainInnerShadow0.setRadius(0.0625 * PREFERRED_HEIGHT); mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5)); mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1 = new InnerShadow(); mainInnerShadow1.setOffsetX(0.0); mainInnerShadow1.setOffsetY(1.0); mainInnerShadow1.setRadius(0.04166667 * PREFERRED_HEIGHT); mainInnerShadow1.setColor(Color.rgb(0, 0, 0, 0.65)); mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1.setInput(mainInnerShadow0); crystalClip = new Rectangle(0, 0, width, height); crystalClip.setArcWidth(5); crystalClip.setArcHeight(5); crystalImage = Helper.createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8); crystalOverlay = new ImageView(crystalImage); crystalOverlay.setClip(crystalClip); boolean crystalEnabled = gauge.isLcdCrystalEnabled(); Helper.enableNode(crystalOverlay, crystalEnabled); threshold = new Path(); threshold.setStroke(null); Helper.enableNode(threshold, gauge.isThresholdVisible()); average = new Path(); average.setStroke(null); Helper.enableNode(average, gauge.isAverageVisible()); backgroundText = new Text(String.format(locale, valueFormatString, gauge.getCurrentValue())); backgroundText.setFill(gauge.getLcdDesign().lcdBackgroundColor); backgroundText.setOpacity((LcdFont.LCD == gauge.getLcdFont() || LcdFont.ELEKTRA == gauge.getLcdFont()) ? 1 : 0); valueText = new Text(String.format(locale, valueFormatString, gauge.getCurrentValue())); valueText.setFill(gauge.getLcdDesign().lcdForegroundColor); unitText = new Text(gauge.getUnit()); unitText.setFill(gauge.getLcdDesign().lcdForegroundColor); Helper.enableNode(unitText, !gauge.getUnit().isEmpty()); title = new Text(gauge.getTitle()); title.setFill(gauge.getLcdDesign().lcdForegroundColor); Helper.enableNode(title, !gauge.getTitle().isEmpty()); lowerRightText = new Text(gauge.getSubTitle()); lowerRightText.setFill(gauge.getLcdDesign().lcdForegroundColor); Helper.enableNode(lowerRightText, !gauge.getSubTitle().isEmpty()); upperLeftText = new Text(String.format(locale, otherFormatString, gauge.getMinMeasuredValue())); upperLeftText.setFill(gauge.getLcdDesign().lcdForegroundColor); Helper.enableNode(upperLeftText, gauge.isMinMeasuredValueVisible()); upperRightText = new Text(String.format(locale, otherFormatString, gauge.getMaxMeasuredValue())); upperRightText.setFill(gauge.getLcdDesign().lcdForegroundColor); Helper.enableNode(upperRightText, gauge.isMaxMeasuredValueVisible()); lowerCenterText = new Text(String.format(locale, otherFormatString, gauge.getOldValue())); lowerCenterText.setFill(gauge.getLcdDesign().lcdForegroundColor); Helper.enableNode(lowerCenterText, gauge.isOldValueVisible()); shadowGroup = new Group(); shadowGroup.setEffect(gauge.isShadowsEnabled() ? FOREGROUND_SHADOW : null); shadowGroup.getChildren().setAll(threshold, average, valueText, unitText, title, lowerRightText, upperLeftText, upperRightText, lowerCenterText); pane = new Pane(crystalOverlay, backgroundText, shadowGroup); pane.setEffect(gauge.isShadowsEnabled() ? mainInnerShadow1 : null); getChildren().setAll(pane); }
Example 5
Source File: LcdClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } mainInnerShadow0 = new InnerShadow(); mainInnerShadow0.setOffsetX(0.0); mainInnerShadow0.setOffsetY(0.0); mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5)); 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.rgb(0, 0, 0, 0.65)); mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1.setInput(mainInnerShadow0); crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT); crystalClip.setArcWidth(5); crystalClip.setArcHeight(5); crystalImage = Helper.createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8); crystalOverlay = new ImageView(crystalImage); crystalOverlay.setClip(crystalClip); boolean crystalEnabled = clock.isLcdCrystalEnabled(); crystalOverlay.setManaged(crystalEnabled); crystalOverlay.setVisible(crystalEnabled); boolean secondsVisible = clock.isSecondsVisible(); backgroundTimeText = new Text(""); backgroundTimeText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundTimeText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText = new Text(""); backgroundSecondText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundSecondText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText.setManaged(secondsVisible); backgroundSecondText.setVisible(secondsVisible); timeText = new Text(""); timeText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText = new Text(""); secondText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText.setManaged(secondsVisible); secondText.setVisible(secondsVisible); title = new Text(clock.getTitle()); title.setFill(clock.getLcdDesign().lcdForegroundColor); boolean titleVisible = clock.isTitleVisible(); title.setManaged(titleVisible); title.setVisible(titleVisible); dateText = new Text(dateFormat.format(clock.getTime())); dateText.setFill(clock.getLcdDesign().lcdForegroundColor); boolean dateVisible = clock.isDateVisible(); dateText.setManaged(dateVisible); dateText.setVisible(dateVisible); dayOfWeekText = new Text(""); dayOfWeekText.setFill(clock.getLcdDesign().lcdForegroundColor); dayOfWeekText.setManaged(dateVisible); dayOfWeekText.setVisible(dateVisible); alarm = new Path(); alarm.setFillRule(FillRule.EVEN_ODD); alarm.setStroke(null); boolean alarmVisible = clock.getAlarms().size() > 0; alarm.setManaged(alarmVisible); alarm.setVisible(alarmVisible); shadowGroup = new Group(); shadowGroup.setEffect(clock.getShadowsEnabled() ? FOREGROUND_SHADOW : null); shadowGroup.getChildren().setAll(timeText, secondText, title, dateText, dayOfWeekText, alarm); pane = new Pane(); pane.setEffect(clock.getShadowsEnabled() ? mainInnerShadow1 : null); pane.getChildren().setAll(crystalOverlay, backgroundTimeText, backgroundSecondText, shadowGroup); getChildren().setAll(pane); }
Example 6
Source File: Regulator.java From regulators with Apache License 2.0 | 4 votes |
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barColor.get()); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(dropShadow); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); text = new Text(String.format(Locale.US, formatString, getTargetValue())); text.setFill(Color.WHITE); text.setTextOrigin(VPos.CENTER); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); symbol = new Region(); symbol.getStyleClass().setAll("symbol"); symbol.setCacheHint(CacheHint.SPEED); icon = new FontIcon(); icon.setTextOrigin(VPos.CENTER); iconPane = new StackPane(symbol, icon); pane = new Pane(barArc, ring, mainCircle, text, indicatorGroup, iconPane); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
Example 7
Source File: ColorRegulator.java From regulators with Apache License 2.0 | 4 votes |
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); Stop[] stops = { new Stop(0.0, Color.rgb(255,255,0)), new Stop(0.125, Color.rgb(255,0,0)), new Stop(0.375, Color.rgb(255,0,255)), new Stop(0.5, Color.rgb(0,0,255)), new Stop(0.625, Color.rgb(0,255,255)), new Stop(0.875, Color.rgb(0,255,0)), new Stop(1.0, Color.rgb(255,255,0)) }; List<Stop> reorderedStops = reorderStops(stops); gradientLookup = new GradientLookup(stops); barGradient = new ConicalGradient(reorderedStops); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT))); buttonOn = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -125, 34.75); buttonOn.setFill(null); buttonOn.setStroke(color.get()); buttonOn.setStrokeLineCap(StrokeLineCap.BUTT); buttonOn.setStrokeWidth(PREFERRED_WIDTH * 0.072); buttonOn.setEffect(dropShadow); buttonOff = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -89.75, 34.75); buttonOff.setFill(null); buttonOff.setStroke(color.get()); buttonOff.setStrokeLineCap(StrokeLineCap.BUTT); buttonOff.setStrokeWidth(PREFERRED_WIDTH * 0.072); buttonOff.setEffect(dropShadow); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(highlight); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); textOn = new Text("ON"); textOn.setFill(textColor.get()); textOn.setTextOrigin(VPos.CENTER); textOn.setMouseTransparent(true); textOn.setRotate(17); textOff = new Text("OFF"); textOff.setFill(textColor.get()); textOff.setTextOrigin(VPos.CENTER); textOff.setMouseTransparent(true); textOff.setRotate(-17); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); innerRing = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.24), new Circle(center, center, PREFERRED_WIDTH * 0.2)); innerRing.setFill(color.get()); currentColorCircle = new Circle(); currentColorCircle.setFill(targetColor.get()); currentColorCircle.setVisible(isOn()); pane = new Pane(barArc, ring, mainCircle, currentColorCircle, innerRing, indicatorGroup, buttonOn, textOn, buttonOff, textOff); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
Example 8
Source File: FeedbackRegulator.java From regulators with Apache License 2.0 | 4 votes |
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); Stop[] stops = { new Stop(0.0, Color.rgb(135, 255, 190)), new Stop(0.125, Color.rgb(254, 190, 106)), new Stop(0.389, Color.rgb(252, 84, 68)), new Stop(0.611, Color.rgb(99, 195, 255)), new Stop(1.0, Color.rgb(125, 255, 190)) }; barGradient = new ConicalGradient(stops); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT))); overlayBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); overlayBarArc.setType(ArcType.OPEN); overlayBarArc.setStrokeLineCap(StrokeLineCap.ROUND); overlayBarArc.setFill(null); overlayBarArc.setStroke(Color.rgb(0, 0, 0, 0.3)); overlayBarArc.setVisible((int) targetValue.get() != (int) currentValue.get()); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(dropShadow); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); text = new Text(String.format(Locale.US, formatString, currentValue.get())); text.setFill(textColor.get()); text.setTextOrigin(VPos.CENTER); targetText = new Text(String.format(Locale.US, formatString, targetValue.get())); targetText.setFill(textColor.get().darker()); targetText.setTextOrigin(VPos.CENTER); targetText.setVisible((int) targetValue.get() != (int) currentValue.get()); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); symbol = new Region(); symbol.getStyleClass().setAll("symbol"); symbol.setCacheHint(CacheHint.SPEED); icon = new FontIcon(); icon.setTextOrigin(VPos.CENTER); iconPane = new StackPane(symbol, icon); pane = new Pane(barArc, overlayBarArc, ring, mainCircle, text, targetText, indicatorGroup, iconPane); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
Example 9
Source File: Led.java From Enzo with Apache License 2.0 | 4 votes |
private void draw() { double size = getWidth() < getHeight() ? getWidth() : getHeight(); canvas.setWidth(size); 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))); 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); }
Example 10
Source File: PushButtonSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frameInnerShadow0 = new InnerShadow(); frameInnerShadow0.setOffsetX(0); frameInnerShadow0.setOffsetY(1); frameInnerShadow0.setRadius(0); frameInnerShadow0.setColor(Color.web("0x333333a6")); frameInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); frameInnerShadow1 = new InnerShadow(); frameInnerShadow1.setOffsetX(0); frameInnerShadow1.setOffsetY(-1); frameInnerShadow1.setRadius(0); frameInnerShadow1.setColor(Color.web("0xeeeeeea6")); frameInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); frameInnerShadow1.setInput(frameInnerShadow0); frame.setEffect(frameInnerShadow1); deselected = new Region(); deselected.getStyleClass().setAll("deselected"); deselectedInnerShadow0 = new InnerShadow(); deselectedInnerShadow0.setOffsetX(0); deselectedInnerShadow0.setOffsetY(-1); deselectedInnerShadow0.setRadius(0); deselectedInnerShadow0.setColor(Color.web("0x4b4e52a6")); deselectedInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); deselectedInnerShadow1 = new InnerShadow(); deselectedInnerShadow1.setOffsetX(0); deselectedInnerShadow1.setOffsetY(1); deselectedInnerShadow1.setRadius(0); deselectedInnerShadow1.setColor(Color.web("0xeeeeeea6")); deselectedInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); deselectedInnerShadow1.setInput(deselectedInnerShadow0); deselectedDropShadow = new DropShadow(); deselectedDropShadow.setOffsetX(0); deselectedDropShadow.setOffsetY(3); deselectedDropShadow.setRadius(3.0 / 128.0 * PREFERRED_WIDTH); deselectedDropShadow.setColor(Color.web("0x000000a6")); deselectedDropShadow.setBlurType(BlurType.TWO_PASS_BOX); deselectedDropShadow.setInput(deselectedInnerShadow1); deselected.setEffect(deselectedDropShadow); selected = new Region(); selected.getStyleClass().setAll("selected"); selectedInnerShadow0 = new InnerShadow(); selectedInnerShadow0.setOffsetX(0); selectedInnerShadow0.setOffsetY(-1); selectedInnerShadow0.setRadius(0); selectedInnerShadow0.setColor(Color.web("0x4b4e52a6")); selectedInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); selectedInnerShadow1 = new InnerShadow(); selectedInnerShadow1.setOffsetX(0); selectedInnerShadow1.setOffsetY(1); selectedInnerShadow1.setRadius(0); selectedInnerShadow1.setColor(Color.web("0xeeeeeea6")); selectedInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); selectedInnerShadow1.setInput(selectedInnerShadow0); selectedDropShadow = new DropShadow(); selectedDropShadow.setOffsetX(0); selectedDropShadow.setOffsetY(0); selectedDropShadow.setRadius(2.0 / 128.0 * PREFERRED_WIDTH); selectedDropShadow.setColor(Color.web("0x000000a6")); selectedDropShadow.setBlurType(BlurType.TWO_PASS_BOX); selectedDropShadow.setInput(selectedInnerShadow1); selected.setEffect(selectedDropShadow); icon = new Region(); icon.getStyleClass().setAll("icon"); pane.getChildren().setAll(frame, deselected, selected, icon); // Adjust visibility dependent on settings updateStatus(); getChildren().setAll(pane); resize(); }
Example 11
Source File: Led.java From Enzo with Apache License 2.0 | 4 votes |
private void draw() { double size = getWidth() < getHeight() ? getWidth() : getHeight(); canvas.setWidth(size); 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, 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); }
Example 12
Source File: LcdClockSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void initGraphics() { // load the fonts Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/digital.ttf"), (0.5833333333 * PREFERRED_HEIGHT)); // "Digital-7" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/digitalreadout.ttf"), (0.5833333333 * PREFERRED_HEIGHT)); // "Digital Readout Upright" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/digitalreadoutb.ttf"), (0.5833333333 * PREFERRED_HEIGHT)); // "Digital Readout Thick Upright" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/elektra.ttf"), (0.58333333 * PREFERRED_HEIGHT)); // "Elektra" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.58333333 * PREFERRED_HEIGHT)); // "OpenSans" 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(); }