use of javafx.scene.effect.GaussianBlur in project bitsquare by bitsquare.
the class Transitions method removeEffect.
private void removeEffect(Node node, int duration) {
if (node != null) {
node.setMouseTransparent(false);
removeEffectTimeLine = new Timeline();
GaussianBlur blur = (GaussianBlur) node.getEffect();
if (blur != null) {
KeyValue kv1 = new KeyValue(blur.radiusProperty(), 0.0);
KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
removeEffectTimeLine.getKeyFrames().add(kf1);
ColorAdjust darken = (ColorAdjust) blur.getInput();
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), 0.0);
KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
removeEffectTimeLine.getKeyFrames().add(kf2);
removeEffectTimeLine.setOnFinished(actionEvent -> {
node.setEffect(null);
removeEffectTimeLine = null;
});
removeEffectTimeLine.play();
} else {
node.setEffect(null);
removeEffectTimeLine = null;
}
}
}
use of javafx.scene.effect.GaussianBlur in project bisq-desktop by bisq-network.
the class Transitions method blur.
public void blur(Node node, int duration, double brightness, boolean removeNode, double blurRadius) {
if (removeEffectTimeLine != null)
removeEffectTimeLine.stop();
node.setMouseTransparent(true);
GaussianBlur blur = new GaussianBlur(0.0);
Timeline timeline = new Timeline();
KeyValue kv1 = new KeyValue(blur.radiusProperty(), blurRadius);
KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
ColorAdjust darken = new ColorAdjust();
darken.setBrightness(0.0);
blur.setInput(darken);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), brightness);
KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
timeline.getKeyFrames().addAll(kf1, kf2);
node.setEffect(blur);
if (removeNode)
timeline.setOnFinished(actionEvent -> UserThread.execute(() -> ((Pane) (node.getParent())).getChildren().remove(node)));
timeline.play();
}
use of javafx.scene.effect.GaussianBlur in project tokentool by RPTools.
the class TokenTool_Controller method initialize.
@FXML
void initialize() {
// Note: A Pane is added to the compositeTokenPane so the ScrollPane doesn't consume the mouse events
assert fileManageOverlaysMenu != null : "fx:id=\"fileManageOverlaysMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert fileSaveAsMenu != null : "fx:id=\"fileSaveAsMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert fileExitMenu != null : "fx:id=\"fileExitMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert editCaptureScreenMenu != null : "fx:id=\"editCaptureScreenMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert editCopyImageMenu != null : "fx:id=\"editCopyImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert editPasteImageMenu != null : "fx:id=\"editPasteImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert helpAboutMenu != null : "fx:id=\"helpAboutMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert saveOptionsPane != null : "fx:id=\"saveOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayOptionsPane != null : "fx:id=\"overlayOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert backgroundOptionsPane != null : "fx:id=\"backgroundOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert zoomOptionsPane != null : "fx:id=\"zoomOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert compositeTokenPane != null : "fx:id=\"compositeTokenPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert tokenPreviewPane != null : "fx:id=\"tokenPreviewPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitScrollPane != null : "fx:id=\"portraitScrollPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert compositeGroup != null : "fx:id=\"compositeGroup\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayTreeView != null : "fx:id=\"overlayTreeview\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitImageView != null : "fx:id=\"portraitImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert maskImageView != null : "fx:id=\"maskImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayImageView != null : "fx:id=\"overlayImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert tokenImageView != null : "fx:id=\"tokenImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert useFileNumberingCheckbox != null : "fx:id=\"useFileNumberingCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayUseAsBaseCheckbox != null : "fx:id=\"overlayUseAsBaseCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert clipPortraitCheckbox != null : "fx:id=\"clipPortraitCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert fileNameTextField != null : "fx:id=\"fileNameTextField\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert fileNameSuffixLabel != null : "fx:id=\"fileNameSuffixLabel\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert fileNameSuffixTextField != null : "fx:id=\"fileNameSuffixTextField\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayNameLabel != null : "fx:id=\"overlayNameLabel\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert backgroundColorPicker != null : "fx:id=\"backgroundColorPicker\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayAspectToggleButton != null : "fx:id=\"overlayAspectToggleButton\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitTransparencySlider != null : "fx:id=\"portraitTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitBlurSlider != null : "fx:id=\"portraitBlurSlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert portraitGlowSlider != null : "fx:id=\"portraitGlowSlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayTransparencySlider != null : "fx:id=\"overlayTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayWidthSpinner != null : "fx:id=\"overlayWidthSpinner\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayHeightSpinner != null : "fx:id=\"overlayHeightSpinner\" was not injected: check your FXML file 'TokenTool.fxml'.";
assert overlayTreeProgressBar != null : "fx:id=\"overlayTreeProgressIndicator\" was not injected: check your FXML file 'ManageOverlays.fxml'.";
executorService = Executors.newCachedThreadPool(runable -> {
loadOverlaysThread = Executors.defaultThreadFactory().newThread(runable);
loadOverlaysThread.setDaemon(true);
return loadOverlaysThread;
});
overlayTreeView.setShowRoot(false);
overlayTreeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> updateCompositImageView((TreeItem<Path>) newValue));
addPseudoClassToLeafs(overlayTreeView);
// Bind color picker to compositeTokenPane background fill
backgroundColorPicker.setValue(Color.TRANSPARENT);
ObjectProperty<Background> background = compositeTokenPane.backgroundProperty();
background.bind(Bindings.createObjectBinding(() -> {
BackgroundFill fill = new BackgroundFill(backgroundColorPicker.getValue(), CornerRadii.EMPTY, Insets.EMPTY);
return new Background(fill);
}, backgroundColorPicker.valueProperty()));
// Bind transparency slider to portraitImageView opacity
portraitTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
portraitImageView.setOpacity(new_val.doubleValue());
updateTokenPreviewImageView();
}
});
// // Restrict text field to valid filename characters
// Pattern validDoubleText = Pattern.compile("[^a-zA-Z0-9\\\\._ \\\\/`~!@#$%\\\\^&\\\\(\\\\)\\\\-\\\\=\\\\+\\\\[\\\\]\\\\{\\\\}',\\\\\\\\:]");
// Pattern validText = Pattern.compile("[^a-zA-Z0-9 ]");
// TextFormatter<> textFormatter = new TextFormatter<>(
// change -> {
// String newText = change.getControlNewText();
// if (validText.matcher(newText).matches()) {
// return change;
// } else
// return null;
// });
// UnaryOperator<TextFormatter.Change> filter = new UnaryOperator<TextFormatter.Change>() {
// @Override
// public TextFormatter.Change apply(TextFormatter.Change t) {
// String validText = "[^a-zA-Z0-9]";
//
// if (t.isReplaced())
// if (t.getText().matches(validText))
// t.setText(t.getControlText().substring(t.getRangeStart(), t.getRangeEnd()));
//
// if (t.isAdded()) {
// if (t.getText().matches(validText)) {
// return null;
// }
// }
//
// return t;
// }
// };
UnaryOperator<Change> filter = change -> {
String text = change.getText();
if (text.matches(AppConstants.VALID_FILE_NAME_PATTERN)) {
return change;
} else {
change.setText(FileSaveUtil.cleanFileName(text));
;
return change;
}
//
// return null;
};
TextFormatter<String> textFormatter = new TextFormatter<>(filter);
fileNameTextField.setTextFormatter(textFormatter);
// Effects
GaussianBlur gaussianBlur = new GaussianBlur(0);
Glow glow = new Glow(0);
gaussianBlur.setInput(glow);
// Bind blur slider to portraitImageView opacity
portraitBlurSlider.valueProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
gaussianBlur.setRadius(new_val.doubleValue());
portraitImageView.setEffect(gaussianBlur);
updateTokenPreviewImageView();
}
});
// Bind glow slider to portraitImageView opacity
portraitGlowSlider.valueProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
glow.setLevel(new_val.doubleValue());
portraitImageView.setEffect(gaussianBlur);
updateTokenPreviewImageView();
}
});
// Bind transparency slider to overlayImageView opacity
overlayTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
overlayImageView.setOpacity(new_val.doubleValue());
updateTokenPreviewImageView();
}
});
// Bind width/height spinners to overlay width/height
overlayWidthSpinner.getValueFactory().valueProperty().bindBidirectional(overlayHeightSpinner.getValueFactory().valueProperty());
overlayWidthSpinner.valueProperty().addListener((observable, oldValue, newValue) -> overlayWidthSpinner_onTextChanged(oldValue, newValue));
overlayHeightSpinner.valueProperty().addListener((observable, oldValue, newValue) -> overlayHeightSpinner_onTextChanged(oldValue, newValue));
}
use of javafx.scene.effect.GaussianBlur in project OTP2_R6_svaap by JNuutinen.
the class LaserBeam method buildLaser.
/**
* Rakentaa projectilen Shapen
* @param color Projectilen väri
* @return Rakennettu PolyLine
*/
private Polyline buildLaser(Color color) {
// Ammuksen muoto
shape = new Polyline();
shape.getPoints().addAll(-0.0, 0.0, WINDOW_WIDTH, 0.0);
Bloom bloom = new Bloom(0.0);
GaussianBlur blur = new GaussianBlur(3.0);
blur.setInput(bloom);
shape.setEffect(blur);
shape.setFill(Color.TRANSPARENT);
shape.setStroke(color);
shape.setStrokeWidth(7.0);
return shape;
}
use of javafx.scene.effect.GaussianBlur in project OTP2_R6_svaap by JNuutinen.
the class Missile method buildProjectile.
/**
* Rakentaa projectilen Polygonin
* @param speed Projectilen nopeus, vaikuttaa hännän pituuteen
* @return Rakennettu Polygon
*/
private Polygon buildProjectile(double speed) {
// Ammuksen muoto
Polygon shape = new Polygon();
shape.getPoints().addAll(-9.0, 0.0, 0.0, -3.0, // ammuksen häntä skaalautuu nopeuden mukaan, mutta on ainakin 1.0
speed * 0.6 + 1.0, // ammuksen häntä skaalautuu nopeuden mukaan, mutta on ainakin 1.0
0.0, 0.0, 3.0);
Bloom bloom = new Bloom(0.0);
GaussianBlur blur = new GaussianBlur(3.0);
blur.setInput(bloom);
shape.setFill(Color.TRANSPARENT);
shape.setStroke(Color.WHITE);
shape.setStrokeWidth(5.0);
shape.getTransforms().add(new Rotate(180, 0, 0));
return shape;
}
Aggregations