本文整理汇总了Java中javafx.scene.effect.GaussianBlur类的典型用法代码示例。如果您正苦于以下问题:Java GaussianBlur类的具体用法?Java GaussianBlur怎么用?Java GaussianBlur使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GaussianBlur类属于javafx.scene.effect包,在下文中一共展示了GaussianBlur类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawShadow
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
public static void drawShadow(Image image, double scale, GraphicsContext dst)
{
final double shadowSize = scale * SHADOW_SIZE;
final double shadowBlur = scale * SHADOW_BLUR;
GaussianBlur blur = new GaussianBlur(shadowBlur);
dst.drawImage(image, shadowSize * 2 / 3, shadowSize);
dst.applyEffect(blur);
ColorAdjust colorAdjust = new ColorAdjust();
colorAdjust.setBrightness(SHADOW_BRIGHTNESS);
dst.applyEffect(colorAdjust);
dst.drawImage(image, 0, shadowSize);
dst.applyEffect(colorAdjust);
}
示例2: setInputEffect
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
protected Effect setInputEffect(Effect a, Effect b)
{
// I don't know a better way to chain effects, it's missing in FX
// https://bugs.openjdk.java.net/browse/JDK-8091895
// perhaps try Blend:
// https://community.oracle.com/thread/2337194?tstart=0
if(b instanceof GaussianBlur)
{
((GaussianBlur)b).setInput(a);
}
else if(b instanceof ColorAdjust)
{
((ColorAdjust)b).setInput(a);
}
else
{
throw new Error("todo: does " + b + " have setInput()?");
}
return b;
}
示例3: createClipPane
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
private Pane createClipPane() {
Pane backgroundPane = new Pane();
backgroundPane.backgroundProperty().bind(background);
FXUtils.bindPrefSize(backgroundPane, this);
FXUtils.setSizeToPref(backgroundPane);
backgroundPane.setManaged(false);
backgroundPane.setEffect(new GaussianBlur(gaussianBlurRadius));
weakBind(() -> backgroundPane.resize(getWidth(), getHeight()),
backgroundPane, "org.to2mbn.lolixl.ui.blurBackground.backgroundSizeListener", this.widthProperty(), this.heightProperty());
Pane clipPane = new Pane();
clipPane.getChildren().add(backgroundPane);
FXUtils.setSizeToPref(clipPane);
clipPane.setStyle("-fx-background-color: transparent;");
clipPane.setSnapToPixel(false);
clipPane.getProperties().put(PROPERTY_CHILD, backgroundPane);
return clipPane;
}
示例4: testHandlePrepareForTestEvent
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
@Test
@Ignore
public void testHandlePrepareForTestEvent() throws Exception {
Stage stage = PowerMockito.mock(Stage.class);
Node node = PowerMockito.mock(Node.class);
Scene scene = PowerMockito.mock(Scene.class);
StackPane root = PowerMockito.mock(StackPane.class);
ObservableList<Node> children = PowerMockito.mock(ObservableList.class);
when(scene.getRoot()).thenReturn(root);
when(stage.getScene()).thenReturn(scene);
when(root.getChildren()).thenReturn(children);
when(children.get(0)).thenReturn(node);
classUnderTest.handlePrepareForTestEvent(any(PrepareTestEvent.class));
verify(node).setEffect(any(GaussianBlur.class));
}
示例5: buildStock
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
/**
* Configures the {@link CardPileView} object that serves as the view
* of the stock.
*/
private void buildStock() {
BackgroundFill backgroundFill = new BackgroundFill(
Color.gray(0.0, 0.2), null, null);
Background background = new Background(backgroundFill);
GaussianBlur gaussianBlur = new GaussianBlur(10);
stockView.setPrefSize(130, 180);
stockView.setBackground(background);
stockView.setLayoutX(95);
stockView.setLayoutY(20);
stockView.setEffect(gaussianBlur);
getChildren().add(stockView);
}
示例6: buildWaste
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
/**
* Configures the {@link CardPileView} object that serves as the view
* of the waste.
*/
private void buildWaste() {
BackgroundFill backgroundFill = new BackgroundFill(
Color.gray(0.0, 0.2), null, null);
Background background = new Background(backgroundFill);
GaussianBlur gaussianBlur = new GaussianBlur(10);
wasteView.setPrefSize(130, 180);
wasteView.setBackground(background);
wasteView.setLayoutX(255);
wasteView.setLayoutY(20);
wasteView.setEffect(gaussianBlur);
getChildren().add(wasteView);
}
示例7: buildFoundationPiles
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
/**
* Configures the {@link CardPileView} objects that serves as the view
* of the foundation piles.
*/
private void buildFoundationPiles() {
BackgroundFill backgroundFill = new BackgroundFill(
Color.gray(0.0, 0.2), null, null);
Background background = new Background(backgroundFill);
GaussianBlur gaussianBlur = new GaussianBlur(10);
IntStream.range(0, 4).forEach(i -> {
foundationPileViews.add(new CardPileView(0, "F" + i));
foundationPileViews.get(i).setPrefSize(130, 180);
foundationPileViews.get(i).setBackground(background);
foundationPileViews.get(i).setLayoutX(575 + i * 160);
foundationPileViews.get(i).setLayoutY(20);
foundationPileViews.get(i).setEffect(gaussianBlur);
getChildren().add(foundationPileViews.get(i));
});
}
示例8: buildStandardPiles
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
/**
* Configures the {@link CardPileView} objects that serves as the view
* of the standard piles.
*/
private void buildStandardPiles() {
BackgroundFill backgroundFill = new BackgroundFill(
Color.gray(0.0, 0.2), null, null);
Background background = new Background(backgroundFill);
GaussianBlur gaussianBlur = new GaussianBlur(10);
IntStream.range(0, 7).forEach(i -> {
standardPileViews.add(new CardPileView(cardGap, "K" + i));
standardPileViews.get(i).setPrefSize(130, 180);
standardPileViews.get(i).setBackground(background);
standardPileViews.get(i).setLayoutX(95 + i * 160);
standardPileViews.get(i).setLayoutY(240);
standardPileViews.get(i).setEffect(gaussianBlur);
getChildren().add(standardPileViews.get(i));
});
}
示例9: TriCircle
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
public TriCircle() {
Shape shape1 = Shape.subtract(new Circle(5), new Circle(2));
shape1.setFill(Color.WHITE);
Shape shape2 = Shape.subtract(new Circle(5), new Circle(2));
shape2.setFill(Color.WHITE);
shape2.setTranslateX(5);
Shape shape3 = Shape.subtract(new Circle(5), new Circle(2));
shape3.setFill(Color.WHITE);
shape3.setTranslateX(2.5);
shape3.setTranslateY(-5);
getChildren().addAll(shape1, shape2, shape3);
setEffect(new GaussianBlur(2));
}
示例10: removeEffect
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
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;
}
}
}
示例11: configureBackground
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
private void configureBackground() {
ImageView imageView = new ImageView();
Image image = loadImage();
imageView.setImage(image);
Circle circle1 = new Circle();
circle1.setCenterX(140);
circle1.setCenterY(140);
circle1.setRadius(120);
circle1.setFill(Color.TRANSPARENT);
circle1.setStroke(Color.web("#0A0A0A"));
circle1.setStrokeWidth(0.3);
Circle circle2 = new Circle();
circle2.setCenterX(140);
circle2.setCenterY(140);
circle2.setRadius(118);
circle2.setFill(Color.TRANSPARENT);
circle2.setStroke(Color.web("#0A0A0A"));
circle2.setStrokeWidth(0.3);
Circle circle3 = new Circle();
circle3.setCenterX(140);
circle3.setCenterY(140);
circle3.setRadius(140);
circle3.setFill(Color.TRANSPARENT);
circle3.setStroke(Color.web("#818a89"));
circle3.setStrokeWidth(1);
Ellipse ellipse = new Ellipse(140, 95, 180, 95);
Circle ellipseClip = new Circle(140, 140, 140);
ellipse.setFill(Color.web("#535450"));
ellipse.setStrokeWidth(0);
GaussianBlur ellipseEffect = new GaussianBlur();
ellipseEffect.setRadius(10);
ellipse.setEffect(ellipseEffect);
ellipse.setOpacity(0.1);
ellipse.setClip(ellipseClip);
background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
示例12: GaussianBlurSample
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
public GaussianBlurSample() {
super(48,48);
ImageView sample = new ImageView(ICON_48);
final GaussianBlur gaussianBlur = new GaussianBlur();
gaussianBlur.setRadius(8d);
sample.setEffect(gaussianBlur);
getChildren().add(sample);
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("GaussianBlur Level", gaussianBlur.radiusProperty(), 0d, 15d)
);
// END REMOVE ME
}
示例13: createIconContent
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
public static Node createIconContent() {
Text sample = new Text("FX");
sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
sample.setStyle("-fx-font-size: 80px;");
sample.setFill(Color.web("#333333"));
final GaussianBlur GaussianBlur = new GaussianBlur();
GaussianBlur.setRadius(15);
sample.setEffect(GaussianBlur);
return sample;
}
示例14: blurOut
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
public static void blurOut(Node node) {
GaussianBlur blur = new GaussianBlur(0.0);
node.setEffect(blur);
Timeline timeline = new Timeline();
KeyValue kv = new KeyValue(blur.radiusProperty(), 10.0);
KeyFrame kf = new KeyFrame(Duration.millis(UI_ANIMATION_TIME_MSEC), kv);
timeline.getKeyFrames().add(kf);
timeline.play();
}
示例15: blurIn
import javafx.scene.effect.GaussianBlur; //导入依赖的package包/类
public static void blurIn(Node node) {
GaussianBlur blur = (GaussianBlur) node.getEffect();
Timeline timeline = new Timeline();
KeyValue kv = new KeyValue(blur.radiusProperty(), 0.0);
KeyFrame kf = new KeyFrame(Duration.millis(UI_ANIMATION_TIME_MSEC), kv);
timeline.getKeyFrames().add(kf);
timeline.setOnFinished(actionEvent -> node.setEffect(null));
timeline.play();
}