javafx.scene.effect.BlurType Java Examples
The following examples show how to use
javafx.scene.effect.BlurType.
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: LcdSkin.java From Enzo with Apache License 2.0 | 6 votes |
public LcdSkin(final Lcd CONTROL) { super(CONTROL); valueOffsetLeft = 0.0; valueOffsetRight = 0.0; digitalFontSizeFactor = 1.0; backgroundTextBuilder = new StringBuilder(); decBuffer = new StringBuilder(16); FOREGROUND_SHADOW.setOffsetX(0); FOREGROUND_SHADOW.setOffsetY(1); FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5)); FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX); FOREGROUND_SHADOW.setRadius(2); init(); initGraphics(); registerListeners(); }
Example #2
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 #3
Source File: Toast.java From ApkToolPlus with Apache License 2.0 | 6 votes |
public Toast(final String msg) { label = new Label(msg); String style = "-fx-background-color:black;" + "-fx-background-radius:10;" + "-fx-font: 16px \"Microsoft YaHei\";" + "-fx-text-fill:white;-fx-padding:10;"; label.setStyle(style); DropShadow dropShadow = new DropShadow(); dropShadow.setBlurType(BlurType.THREE_PASS_BOX); dropShadow.setWidth(40); dropShadow.setHeight(40); dropShadow.setRadius(19.5); dropShadow.setOffsetX(0); dropShadow.setOffsetY(00); dropShadow.setColor(Color.color(0, 0, 0)); label.setEffect(dropShadow); }
Example #4
Source File: LcdSkin.java From Medusa with Apache License 2.0 | 6 votes |
public LcdSkin(Gauge gauge) { super(gauge); width = PREFERRED_WIDTH; height = PREFERRED_HEIGHT; valueOffsetLeft = 0.0; valueOffsetRight = 0.0; digitalFontSizeFactor = 1.0; backgroundTextBuilder = new StringBuilder(); valueFormatString = new StringBuilder("%.").append(gauge.getDecimals()).append("f").toString(); otherFormatString = new StringBuilder("%.").append(gauge.getTickLabelDecimals()).append("f").toString(); locale = gauge.getLocale(); sections = gauge.getSections(); sectionColorMap = new HashMap<>(sections.size()); currentValueListener = o -> handleEvents("REDRAW"); updateSectionColors(); FOREGROUND_SHADOW.setOffsetX(0); FOREGROUND_SHADOW.setOffsetY(1); FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5)); FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX); FOREGROUND_SHADOW.setRadius(2); initGraphics(); registerListeners(); }
Example #5
Source File: IconText.java From helloiot with GNU General Public License v3.0 | 6 votes |
@Override public Node buildIcon(StringFormat format, byte[] value) { Text t = new Text(format.format(format.value(value))); t.setFont(Font.font(ExternalFonts.SOURCESANSPRO_BLACK, FontWeight.BOLD, 32.0)); t.setFill(Color.WHITE); DropShadow dropShadow = new DropShadow(); dropShadow.setRadius(4.0); dropShadow.setColor(Color.BLACK /* valueOf("#4b5157")*/); dropShadow.setBlurType(BlurType.ONE_PASS_BOX); t.setEffect(dropShadow); return t; }
Example #6
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 #7
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 #8
Source File: UiUtil.java From Recaf with MIT License | 6 votes |
private static void animate(Node node, long millis, int r, int g, int b) { DoubleProperty dblProp = new SimpleDoubleProperty(1); dblProp.addListener((ob, o, n) -> { InnerShadow innerShadow = new InnerShadow(); innerShadow.setBlurType(BlurType.ONE_PASS_BOX); innerShadow.setChoke(1); innerShadow.setRadius(5); innerShadow.setColor(Color.rgb(r, g, b, n.doubleValue())); node.setEffect(innerShadow); }); Timeline timeline = new Timeline(); KeyValue kv = new KeyValue(dblProp, 0); KeyFrame kf = new KeyFrame(Duration.millis(millis), kv); timeline.getKeyFrames().add(kf); timeline.play(); }
Example #9
Source File: LcdClockSkin.java From Enzo with Apache License 2.0 | 6 votes |
public LcdClockSkin(final LcdClock CONTROL) { super(CONTROL); aspectRatio = PREFERRED_HEIGHT / PREFERRED_WIDTH; valueOffsetRight = 0.0; digitalFontSizeFactor = 1.0; backgroundTextBuilder = new StringBuilder(); FOREGROUND_SHADOW.setOffsetX(0); FOREGROUND_SHADOW.setOffsetY(1); FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5)); FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX); FOREGROUND_SHADOW.setRadius(2); adjustDateFormat(); init(); initGraphics(); registerListeners(); }
Example #10
Source File: Undecorator.java From DevToolBox with GNU Lesser General Public License v2.1 | 6 votes |
/** * Prepare Stage for dock feedback display */ void buildDockFeedbackStage() { dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT); dockFeedback = new Rectangle(0, 0, 100, 100); dockFeedback.setArcHeight(10); dockFeedback.setArcWidth(10); dockFeedback.setFill(Color.TRANSPARENT); dockFeedback.setStroke(Color.BLACK); dockFeedback.setStrokeWidth(2); dockFeedback.setCache(true); dockFeedback.setCacheHint(CacheHint.SPEED); dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3)); dockFeedback.setMouseTransparent(true); BorderPane borderpane = new BorderPane(); borderpane.setStyle("-fx-background-color:transparent"); //J8 borderpane.setCenter(dockFeedback); Scene scene = new Scene(borderpane); scene.setFill(Color.TRANSPARENT); dockFeedbackPopup.setScene(scene); dockFeedbackPopup.sizeToScene(); }
Example #11
Source File: TileSkin.java From OEE-Designer with MIT License | 6 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); notifyRegion = new NotifyRegion(); enableNode(notifyRegion, false); pane = new Pane(notifyRegion); 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 #12
Source File: LedSkin.java From JFX8CustomControls with Apache License 2.0 | 6 votes |
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0); led = new Region(); led.getStyleClass().setAll("main"); led.setStyle("-led-color: " + (getSkinnable().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, (Color) getSkinnable().getLedColor(), 20, 0d, 0d, 0d); glow.setInput(innerShadow); highlight = new Region(); highlight.getStyleClass().setAll("highlight"); getChildren().addAll(frame, led, highlight); }
Example #13
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 #14
Source File: Vertex.java From constellation with Apache License 2.0 | 5 votes |
private void updateSelectedVisualIndication() { if (isSelected) { Color highlightColor = selectedWithTransaction ? Color.RED : Color.YELLOW; triangle.setEffect(new DropShadow(BlurType.GAUSSIAN, highlightColor, 15.0, 0.45, 0.0, 0.0)); } else { // Remove the selection effect: triangle.setEffect(null); } }
Example #15
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 #16
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 #17
Source File: JFXDepthManager.java From JFoenix with Apache License 2.0 | 5 votes |
/** * this method is used to add shadow effect to the node, * however the shadow is not real ( gets affected with node transformations) * <p> * use {@link #createMaterialNode(Node, int)} instead to generate a real shadow */ public static void setDepth(Node control, int level) { level = level < 0 ? 0 : level; level = level > 5 ? 5 : level; control.setEffect(new DropShadow(BlurType.GAUSSIAN, depth[level].getColor(), depth[level].getRadius(), depth[level].getSpread(), depth[level].getOffsetX(), depth[level].getOffsetY())); }
Example #18
Source File: LcdClockSkin.java From Medusa with Apache License 2.0 | 5 votes |
public LcdClockSkin(Clock clock) { super(clock); digitalFontSizeFactor = 1.0; backgroundTextBuilder = new StringBuilder(); FOREGROUND_SHADOW.setOffsetX(0); FOREGROUND_SHADOW.setOffsetY(1); FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5)); FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX); FOREGROUND_SHADOW.setRadius(2); adjustDateFormat(); initGraphics(); registerListeners(); }
Example #19
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 #20
Source File: Transaction.java From constellation with Apache License 2.0 | 5 votes |
/** * Updates the selected state of this timeline, and if <code>true</code>, * visually updates the transaction with a 'glow'. * * @param selected Whether the transaction is currently selected. */ public void setSelected(final boolean selected) { isSelected = selected; if (isSelected) { this.setEffect(new DropShadow(BlurType.GAUSSIAN, Color.RED, 15.0, 0.45, 0.0, 0.0)); } else { // Remove the selection effect: this.setEffect(null); } }
Example #21
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 #22
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 #23
Source File: SerializableDropShadow.java From Quelea with GNU General Public License v3.0 | 5 votes |
public DropShadow getDropShadow() { DropShadow shadow = new DropShadow(); if (use) { shadow.setColor(getColor()); } else { shadow.setColor(Color.TRANSPARENT); } shadow.setOffsetX(getOffsetX()); shadow.setOffsetY(getOffsetY()); shadow.setSpread(getSpread()); shadow.setRadius(getRadius()); shadow.setBlurType(BlurType.GAUSSIAN); return shadow; }
Example #24
Source File: ScatterChartPane.java From constellation with Apache License 2.0 | 5 votes |
/** * Update the current selection on the ScatterChart within this * ScatterChartPane. This allows a primary selection (which will highlight * in red) as well as a secondary selection (which will highlight in * yellow). * * @param primarySelection the set of data objects representing the primary * selection. * @param secondarySelection the set of data objects representing the * secondary selection. */ protected void selectElementsOnChart(final Set<ScatterData> primarySelection, final Set<ScatterData> secondarySelection) { final DropShadow primarySelectionShadow = new DropShadow(BlurType.THREE_PASS_BOX, Color.RED, 20.0, 0.85, 0.0, 0.0); final DropShadow secondarySelectionShadow = new DropShadow(BlurType.THREE_PASS_BOX, Color.YELLOW, 20.0, 0.85, 0.0, 0.0); Platform.runLater(() -> { synchronized (currentData) { for (final ScatterData data : currentData) { if (secondarySelection != null && secondarySelection.contains(data)) { data.getData().getNode().setEffect(secondarySelectionShadow); continue; } if (primarySelection != null && primarySelection.contains(data)) { data.getData().getNode().setEffect(primarySelectionShadow); continue; } @SuppressWarnings("unchecked") // getData will return data of type number and number Data<Number, Number> data2 = (Data<Number, Number>) data.getData(); Node dataNode = data2.getNode(); dataNode.setEffect(null); } } }); if (primarySelection != null && !currentSelectedData.equals(primarySelection)) { currentSelectedData.clear(); currentSelectedData.addAll(primarySelection); } }
Example #25
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 #26
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 #27
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 #28
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 #29
Source File: CustomPlainAmpSkin.java From medusademo 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); needle.getStyleClass().add("needle"); 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); shadowGroup.getStyleClass().add("shadow-group"); unitText = new Text(gauge.getUnit()); unitText.setMouseTransparent(true); unitText.setTextOrigin(VPos.CENTER); unitText.getStyleClass().add("unit"); 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.66 * PREFERRED_HEIGHT); lcd.getStyleClass().add("lcd"); 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()); lcdText.getStyleClass().add("lcd-foreground"); // 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); // Add all nodes pane = new Pane(); pane.getChildren().setAll(ticksAndSectionsCanvas, markerPane, ledCanvas, unitText, lcd, lcdText, shadowGroup); pane.getStyleClass().add("background-pane"); getChildren().setAll(pane); }
Example #30
Source File: JFXDepthManager.java From JFoenix with Apache License 2.0 | 4 votes |
public static void pop(Node control) { control.setEffect(new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.26), 5, 0.05, 0, 1)); }