Java Code Examples for javafx.scene.effect.BlurType#TWO_PASS_BOX
The following examples show how to use
javafx.scene.effect.BlurType#TWO_PASS_BOX .
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: LedTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); ledBorder = new Circle(); led = new Circle(); hightlight = new Circle(); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0); led.setEffect(innerShadow); getPane().getChildren().addAll(titleText, text, description, ledBorder, led, hightlight); }
Example 2
Source File: LedSkin.java From Enzo with Apache License 2.0 | 6 votes |
private void initGraphics() { frame = new Region(); frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0); led = new Region(); led.setStyle("-led-color: " + Util.colorToCss((Color) getSkinnable().getLedColor()) + ";"); 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, (Color) getSkinnable().getLedColor(), 20, 0d, 0d, 0d); glow.setInput(innerShadow); highlight = new Region(); // Set the appropriate style classes changeStyle(); // Add all nodes getChildren().setAll(frame, led, highlight); }
Example 3
Source File: CustomGaugeSkin.java From medusademo with Apache License 2.0 | 6 votes |
private void initGraphics() { backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); backgroundCtx = backgroundCanvas.getGraphicsContext2D(); foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); foregroundCtx = foregroundCanvas.getGraphicsContext2D(); ledInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0); ledDropShadow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0); pane = new Pane(backgroundCanvas, foregroundCanvas); pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example 4
Source File: Led.java From JFX8CustomControls with Apache License 2.0 | 6 votes |
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frame.setOpacity(isFrameVisible() ? 1 : 0); led = new Region(); led.getStyleClass().setAll("main"); led.setStyle("-led-color: " + (getLedColor()).toString().replace("0x", "#") + ";"); 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, getLedColor(), 20, 0d, 0d, 0d); glow.setInput(innerShadow); highlight = new Region(); highlight.getStyleClass().setAll("highlight"); // Add all nodes getChildren().addAll(frame, led, highlight); }
Example 5
Source File: TileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
protected void initGraphics() { // Set initial size if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 || Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) { if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) { tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight()); } else { tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0); backgroundImageView = new ImageView(); backgroundImageView.setPreserveRatio(true); backgroundImageView.setMouseTransparent(true); if (null == tile.getBackgroundImage()) { enableNode(backgroundImageView, false); } else { backgroundImageView.setImage(tile.getBackgroundImage()); enableNode(backgroundImageView, true); } notifyRegion = new NotifyRegion(); enableNode(notifyRegion, false); infoRegion = new InfoRegion(); infoRegion.setPickOnBounds(false); enableNode(infoRegion, false); lowerRightRegion = new LowerRightRegion(); enableNode(lowerRightRegion, false); pane = new Pane(backgroundImageView, notifyRegion, infoRegion, lowerRightRegion); pane.getStyleClass().add("tile"); pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY))); getChildren().setAll(pane); }
Example 6
Source File: Switch.java From tilesfx with Apache License 2.0 | 5 votes |
private void initGraphics() { if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) { if (getPrefWidth() > 0 && getPrefHeight() > 0) { setPrefSize(getPrefWidth(), getPrefHeight()); } else { setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } getStyleClass().add("switch"); shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0); switchBorder = new Rectangle(); switchBorder.setFill(getForegroundColor()); switchBackground = new Rectangle(); switchBackground.setMouseTransparent(true); switchBackground.setFill(isActive() ? getActiveColor() : getBackgroundColor()); thumb = new Circle(); thumb.setMouseTransparent(true); thumb.setFill(getForegroundColor()); thumb.setEffect(shadow); pane = new Pane(switchBorder, switchBackground, thumb); getChildren().setAll(pane); }
Example 7
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 8
Source File: DashboardSkin.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); } } unitText = new Text(gauge.getUnit()); unitText.setTextOrigin(VPos.CENTER); unitText.setFill(gauge.getUnitColor()); Helper.enableNode(unitText, !gauge.getUnit().isEmpty()); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue())); valueText.setTextOrigin(VPos.CENTER); valueText.setFill(gauge.getValueColor()); Helper.enableNode(valueText, gauge.isValueVisible()); minValue = gauge.getMinValue(); minText = new Text(String.format(locale, otherFormatString, minValue)); minText.setTextOrigin(VPos.CENTER); minText.setFill(gauge.getValueColor()); maxText = new Text(String.format(locale, otherFormatString, gauge.getMaxValue())); maxText.setTextOrigin(VPos.CENTER); maxText.setFill(gauge.getValueColor()); boolean tickLabelsVisible = gauge.getTickLabelsVisible(); Helper.enableNode(minText, tickLabelsVisible); Helper.enableNode(maxText, tickLabelsVisible); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.3), 30.0, 0.0, 0.0, 10.0); barBackgroundStart = new MoveTo(0, 0.675 * PREFERRED_HEIGHT); barBackgroundOuterArc = new ArcTo(0.675 * PREFERRED_HEIGHT, 0.675 * PREFERRED_HEIGHT, 0, PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT, true, true); barBackgroundLineToInnerArc = new LineTo(0.72222 * PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT); barBackgroundInnerArc = new ArcTo(0.3 * PREFERRED_HEIGHT, 0.3 * PREFERRED_HEIGHT, 0, 0.27778 * PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT, false, false); barBackground = new Path(); barBackground.setFillRule(FillRule.EVEN_ODD); barBackground.getElements().add(barBackgroundStart); barBackground.getElements().add(barBackgroundOuterArc); barBackground.getElements().add(barBackgroundLineToInnerArc); barBackground.getElements().add(barBackgroundInnerArc); barBackground.getElements().add(new ClosePath()); barBackground.setFill(gauge.getBarBackgroundColor()); barBackground.setStroke(gauge.getBorderPaint()); barBackground.setEffect(gauge.isShadowsEnabled() ? innerShadow : null); dataBarStart = new MoveTo(0, 0.675 * PREFERRED_HEIGHT); dataBarOuterArc = new ArcTo(0.675 * PREFERRED_HEIGHT, 0.675 * PREFERRED_HEIGHT, 0, 0, 0, false, true); dataBarLineToInnerArc = new LineTo(0.27778 * PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT); dataBarInnerArc = new ArcTo(0.3 * PREFERRED_HEIGHT, 0.3 * PREFERRED_HEIGHT, 0, 0, 0, false, false); dataBar = new Path(); dataBar.setFillRule(FillRule.EVEN_ODD); dataBar.getElements().add(dataBarStart); dataBar.getElements().add(dataBarOuterArc); dataBar.getElements().add(dataBarLineToInnerArc); dataBar.getElements().add(dataBarInnerArc); dataBar.getElements().add(new ClosePath()); dataBar.setFill(gauge.getBarColor()); dataBar.setStroke(gauge.getBorderPaint()); dataBar.setEffect(gauge.isShadowsEnabled() ? innerShadow : null); threshold = new Line(); threshold.setStrokeLineCap(StrokeLineCap.BUTT); Helper.enableNode(threshold, gauge.isThresholdVisible()); thresholdText = new Text(String.format(locale, formatString, gauge.getThreshold())); Helper.enableNode(thresholdText, gauge.isThresholdVisible()); pane = new Pane(unitText, titleText, valueText, minText, maxText, barBackground, dataBar, threshold, thresholdText); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example 9
Source File: HeatControlSkin.java From Enzo with Apache License 2.0 | 4 votes |
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.opensansSemiBold(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.opensansBold(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); }
Example 10
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 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, ((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 12
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 13
Source File: BarSkin.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); } } Color barColor = gauge.getBarColor(); gauge.setGradientBarStops(new Stop(0.0, barColor), new Stop(0.01, barColor), new Stop(0.75, barColor.deriveColor(-10, 1, 1, 1)), new Stop(1.0, barColor.deriveColor(-20, 1, 1, 1))); shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.45), 0.01 * PREFERRED_WIDTH, 0, 0.01 * PREFERRED_WIDTH, 0); circle = new Circle(); circle.setFill(null); arc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, 0); arc.setStrokeWidth(PREFERRED_WIDTH * 0.008); arc.setStrokeType(StrokeType.CENTERED); arc.setStrokeLineCap(StrokeLineCap.ROUND); arc.setFill(null); fakeDot = new Circle(); fakeDot.setStroke(null); dot = new Circle(); dot.setStroke(null); dot.setVisible(false); dot.setEffect(shadow); titleText = new Text(gauge.getTitle()); titleText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.5)); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue())); valueText.setFont(Fonts.robotoRegular(PREFERRED_WIDTH * 0.27333)); valueText.setFill(gauge.getValueColor()); Helper.enableNode(valueText, gauge.isValueVisible()); unitText = new Text(gauge.getUnit()); unitText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.08)); unitText.setFill(gauge.getUnitColor()); Helper.enableNode(unitText, !gauge.getUnit().isEmpty()); pane = new Pane(circle, arc, fakeDot, dot, titleText, valueText, unitText); getChildren().setAll(pane); }
Example 14
Source File: GaugeSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void resize() { double width = gauge.getWidth() - gauge.getInsets().getLeft() - gauge.getInsets().getRight(); double height = gauge.getHeight() - gauge.getInsets().getTop() - gauge.getInsets().getBottom(); size = width < height ? width : height; if (size > 0) { double center = size * 0.5; pane.setMaxSize(size, size); pane.relocate((gauge.getWidth() - size) * 0.5, (gauge.getHeight() - size) * 0.5); dropShadow.setRadius(0.008 * size); dropShadow.setOffsetY(0.008 * size); backgroundInnerShadow.setOffsetX(0); backgroundInnerShadow.setOffsetY(size * 0.03); backgroundInnerShadow.setRadius(size * 0.04); pane.setEffect(gauge.isInnerShadowEnabled() ? backgroundInnerShadow : null); sectionsAndAreasCanvas.setWidth(size); sectionsAndAreasCanvas.setHeight(size); tickMarkCanvas.setWidth(size); tickMarkCanvas.setHeight(size); markerPane.setPrefSize(size, size); boolean isFlatLed = LedType.FLAT == gauge.getLedType(); ledSize = 0.07 * size; ledCanvas.setWidth(ledSize); ledCanvas.setHeight(ledSize); ledCanvas.relocate(0.3 * size, 0.47 * size); ledOffShadow = isFlatLed ? null : new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0); ledOnShadow = isFlatLed ? null : new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0); if (!isFlatLed) ledOnShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, gauge.getLedColor(), 0.36 * ledSize, 0, 0, 0)); resizeText(); if (gauge.isLcdVisible()) { lcd.setWidth(0.4 * size); lcd.setHeight(0.114 * size); lcd.setArcWidth(0.0125 * size); lcd.setArcHeight(0.0125 * size); lcd.relocate((size - lcd.getWidth()) * 0.5, 0.583 * size); switch(gauge.getLcdFont()) { case LCD: valueText.setFont(Fonts.digital(0.108 * size)); valueText.setTranslateY(0.64 * size); break; case DIGITAL: valueText.setFont(Fonts.digitalReadout(0.105 * size)); valueText.setTranslateY(0.65 * size); break; case DIGITAL_BOLD: valueText.setFont(Fonts.digitalReadoutBold(0.105 * size)); valueText.setTranslateY(0.65 * size); break; case ELEKTRA: valueText.setFont(Fonts.elektra(0.1116 * size)); valueText.setTranslateY(0.645 * size); break; case STANDARD: default: valueText.setFont(Fonts.robotoMedium(0.09 * size)); valueText.setTranslateY(0.64 * size); break; } valueText.setTranslateX((0.691 * size - valueText.getLayoutBounds().getWidth())); } else { valueText.setFont(Fonts.robotoMedium(size * 0.1)); valueText.setTranslateX((size - valueText.getLayoutBounds().getWidth()) * 0.5); valueText.setTranslateY(size * 0.65); } drawNeedle(); knobCanvas.setWidth(size * 0.1); knobCanvas.setHeight(size * 0.1); knobCanvas.relocate(center - size * 0.05, center - size * 0.05); buttonTooltip.setText(gauge.getButtonTooltipText()); } }
Example 15
Source File: AmpSkin.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); } } ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D(); ledCanvas = new Canvas(); led = ledCanvas.getGraphicsContext2D(); thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")"); thresholdTooltip.setTextAlignment(TextAlignment.CENTER); threshold = new Path(); Helper.enableNode(threshold, gauge.isThresholdVisible()); Tooltip.install(threshold, thresholdTooltip); average = new Path(); Helper.enableNode(average, gauge.isAverageVisible()); markerPane = new Pane(); needleRotate = new Rotate(180 - START_ANGLE); needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleLineTo5 = new LineTo(); needleCubicCurveTo6 = new CubicCurveTo(); needleClosePath7 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7); needle.setFillRule(FillRule.EVEN_ODD); needle.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); shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); unitText = new Text(gauge.getUnit()); unitText.setMouseTransparent(true); unitText.setTextOrigin(VPos.CENTER); lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT); lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT); lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT); lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.44 * PREFERRED_HEIGHT); Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible()); lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue())); lcdText.setAlignment(Pos.CENTER_RIGHT); lcdText.setVisible(gauge.isValueVisible()); // Set initial value angleStep = ANGLE_RANGE / gauge.getRange(); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; targetAngle = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle); needleRotate.setAngle(targetAngle); lightEffect = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.65), 2, 0.0, 0.0, 2.0); foreground = new SVGPath(); foreground.setContent("M 26 26.5 C 26 20.2432 26.2432 20 32.5 20 L 277.5 20 C 283.7568 20 284 20.2432 284 26.5 L 284 143.5 C 284 149.7568 283.7568 150 277.5 150 L 32.5 150 C 26.2432 150 26 149.7568 26 143.5 L 26 26.5 ZM 0 6.7241 L 0 253.2758 C 0 260 0 260 6.75 260 L 303.25 260 C 310 260 310 260 310 253.2758 L 310 6.7241 C 310 0 310 0 303.25 0 L 6.75 0 C 0 0 0 0 0 6.7241 Z"); foreground.setEffect(lightEffect); // Add all nodes pane = new Pane(); pane.getChildren().setAll(ticksAndSectionsCanvas, markerPane, ledCanvas, unitText, lcd, lcdText, shadowGroup, foreground, titleText); getChildren().setAll(pane); }
Example 16
Source File: InteractiveGaugeSkin.java From medusademo with Apache License 2.0 | 4 votes |
private void resize() { double width = getSkinnable().getWidth() - getSkinnable().getInsets().getLeft() - getSkinnable().getInsets().getRight(); double height = getSkinnable().getHeight() - getSkinnable().getInsets().getTop() - getSkinnable().getInsets().getBottom(); size = width < height ? width : height; if (size > 0) { double center = size * 0.5; pane.setMaxSize(size, size); pane.relocate((getSkinnable().getWidth() - size) * 0.5, (getSkinnable().getHeight() - size) * 0.5); dropShadow.setRadius(0.008 * size); dropShadow.setOffsetY(0.008 * size); backgroundInnerShadow.setOffsetX(0); backgroundInnerShadow.setOffsetY(size * 0.03); backgroundInnerShadow.setRadius(size * 0.04); pane.setEffect(getSkinnable().isInnerShadowEnabled() ? backgroundInnerShadow : null); sectionsAndAreasCanvas.setWidth(size); sectionsAndAreasCanvas.setHeight(size); tickMarkCanvas.setWidth(size); tickMarkCanvas.setHeight(size); markerPane.setPrefSize(size, size); boolean isFlatLed = LedType.FLAT == getSkinnable().getLedType(); ledSize = isFlatLed ? 0.05 * size : 0.06 * size; ledCanvas.setWidth(ledSize); ledCanvas.setHeight(ledSize); ledCanvas.relocate(0.65 * size, 0.47 * size); ledOffShadow = isFlatLed ? null : new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0); ledOnShadow = isFlatLed ? null : new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0); if (!isFlatLed) ledOnShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getLedColor(), 0.36 * ledSize, 0, 0, 0)); resizeText(); if (getSkinnable().isLcdVisible()) { lcd.setWidth(0.4 * size); lcd.setHeight(0.114 * size); lcd.setArcWidth(0.0125 * size); lcd.setArcHeight(0.0125 * size); lcd.relocate((size - lcd.getWidth()) * 0.5, 0.583 * size); switch(getSkinnable().getLcdFont()) { case LCD: valueText.setFont(Fonts.digital(0.108 * size)); valueText.setTranslateY(0.64 * size); break; case DIGITAL: valueText.setFont(Fonts.digitalReadout(0.105 * size)); valueText.setTranslateY(0.65 * size); break; case DIGITAL_BOLD: valueText.setFont(Fonts.digitalReadoutBold(0.105 * size)); valueText.setTranslateY(0.65 * size); break; case ELEKTRA: valueText.setFont(Fonts.elektra(0.1116 * size)); valueText.setTranslateY(0.645 * size); break; case STANDARD: default: valueText.setFont(Fonts.robotoMedium(0.09 * size)); valueText.setTranslateY(0.64 * size); break; } valueText.setTranslateX((0.691 * size - valueText.getLayoutBounds().getWidth())); } else { valueText.setFont(Fonts.robotoMedium(size * 0.1)); valueText.setTranslateX((size - valueText.getLayoutBounds().getWidth()) * 0.5); valueText.setTranslateY(size * 0.65); } drawNeedle(); knobCanvas.setWidth(size * 0.1); knobCanvas.setHeight(size * 0.1); knobCanvas.relocate(center - size * 0.05, center - size * 0.05); buttonTooltip.setText(getSkinnable().getButtonTooltipText()); } }
Example 17
Source File: RadarNodeChart.java From tilesfx with Apache License 2.0 | 4 votes |
private void initGraphics() { stops = new ArrayList<>(16); for (Stop stop : getGradientStops()) { if (Double.compare(stop.getOffset(), 0.0) == 0) stops.add(new Stop(0, stop.getColor())); stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor())); } chartPath = new Path(); overlayPath = new Path(); overlayPath.setFill(Color.TRANSPARENT); centerCircle = new Circle(); thresholdCircle = new Circle(); thresholdCircle.setFill(Color.TRANSPARENT); unitText = new Text(getUnit()); unitText.setTextAlignment(TextAlignment.CENTER); unitText.setTextOrigin(VPos.CENTER); unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH)); legendStep = (getMaxValue() - getMinValue()) / 5d; dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0); minValueText = new Text(String.format(Locale.US, formatString, getMinValue())); minValueText.setTextAlignment(TextAlignment.CENTER); minValueText.setTextOrigin(VPos.CENTER); minValueText.setVisible(isLegendVisible()); minValueText.setEffect(dropShadow); legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep)); legend1Text.setTextAlignment(TextAlignment.CENTER); legend1Text.setTextOrigin(VPos.CENTER); legend1Text.setVisible(isLegendVisible()); legend1Text.setEffect(dropShadow); legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2)); legend2Text.setTextAlignment(TextAlignment.CENTER); legend2Text.setTextOrigin(VPos.CENTER); legend2Text.setVisible(isLegendVisible()); legend2Text.setEffect(dropShadow); legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend3Text.setTextAlignment(TextAlignment.CENTER); legend3Text.setTextOrigin(VPos.CENTER); legend3Text.setVisible(isLegendVisible()); legend3Text.setEffect(dropShadow); legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend4Text.setTextAlignment(TextAlignment.CENTER); legend4Text.setTextOrigin(VPos.CENTER); legend4Text.setVisible(isLegendVisible()); legend4Text.setEffect(dropShadow); maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue())); maxValueText.setTextAlignment(TextAlignment.CENTER); maxValueText.setTextOrigin(VPos.CENTER); maxValueText.setVisible(isLegendVisible()); maxValueText.setEffect(dropShadow); textGroup = new Group(); // Add all nodes pane = new Pane(chartPath, overlayPath, centerCircle, thresholdCircle, textGroup, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText); getChildren().setAll(pane); }
Example 18
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 19
Source File: RadarChart.java From OEE-Designer with MIT License | 4 votes |
private void initGraphics() { stops = new ArrayList<>(16); for (Stop stop : getGradientStops()) { if (Double.compare(stop.getOffset(), 0.0) == 0) stops.add(new Stop(0, stop.getColor())); stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor())); } chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); chartCtx = chartCanvas.getGraphicsContext2D(); overlayCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); overlayCtx = overlayCanvas.getGraphicsContext2D(); unitText = new Text(getUnit()); unitText.setTextAlignment(TextAlignment.CENTER); unitText.setTextOrigin(VPos.CENTER); unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH)); legendStep = (getMaxValue() - getMinValue()) / 5d; dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0); minValueText = new Text(String.format(Locale.US, formatString, getMinValue())); minValueText.setTextAlignment(TextAlignment.CENTER); minValueText.setTextOrigin(VPos.CENTER); minValueText.setVisible(isLegendVisible()); minValueText.setEffect(dropShadow); legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep)); legend1Text.setTextAlignment(TextAlignment.CENTER); legend1Text.setTextOrigin(VPos.CENTER); legend1Text.setVisible(isLegendVisible()); legend1Text.setEffect(dropShadow); legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2)); legend2Text.setTextAlignment(TextAlignment.CENTER); legend2Text.setTextOrigin(VPos.CENTER); legend2Text.setVisible(isLegendVisible()); legend2Text.setEffect(dropShadow); legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend3Text.setTextAlignment(TextAlignment.CENTER); legend3Text.setTextOrigin(VPos.CENTER); legend3Text.setVisible(isLegendVisible()); legend3Text.setEffect(dropShadow); legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend4Text.setTextAlignment(TextAlignment.CENTER); legend4Text.setTextOrigin(VPos.CENTER); legend4Text.setVisible(isLegendVisible()); legend4Text.setEffect(dropShadow); maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue())); maxValueText.setTextAlignment(TextAlignment.CENTER); maxValueText.setTextOrigin(VPos.CENTER); maxValueText.setVisible(isLegendVisible()); maxValueText.setEffect(dropShadow); // Add all nodes pane = new Pane(chartCanvas, overlayCanvas, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText); pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 20
Source File: FGauge.java From Medusa with Apache License 2.0 | 3 votes |
private void initGraphics() { innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.35), 20, 0.0, 0, 20); frame = new Region(); background = new Circle(); background.setEffect(innerShadow); foreground = new Circle(); foreground.setMouseTransparent(true); getChildren().setAll(frame, background, gauge, foreground); }