本文整理汇总了Java中javafx.scene.image.ImageView.setEffect方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setEffect方法的具体用法?Java ImageView.setEffect怎么用?Java ImageView.setEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.setEffect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showQRCode
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@FXML
protected void showQRCode(MouseEvent event) {
// Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
// lazy tonight.
final byte[] imageBytes = QRCode
.from(uri())
.withSize(320, 240)
.to(ImageType.PNG)
.stream()
.toByteArray();
Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
ImageView view = new ImageView(qrImage);
view.setEffect(new DropShadow());
// Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
// Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
// non-centered on the screen. Finally fade/blur it in.
Pane pane = new Pane(view);
pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
view.setOnMouseClicked(event1 -> overlay.done());
}
示例2: ReflectionSample
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public ReflectionSample() {
super(100,200);
ImageView sample = new ImageView(BOAT);
sample.setPreserveRatio(true);
sample.setFitHeight(100);
final Reflection reflection = new Reflection();
sample.setEffect(reflection);
getChildren().add(sample);
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Reflection Bottom Opacity", reflection.bottomOpacityProperty(), 0d, 1d),
new SimplePropertySheet.PropDesc("Reflection Top Opacity", reflection.topOpacityProperty(), 0d, 1d),
new SimplePropertySheet.PropDesc("Reflection Fraction", reflection.fractionProperty(), 0d, 1d),
new SimplePropertySheet.PropDesc("Reflection Top Offset", reflection.topOffsetProperty(), -10d, 10d)
);
// END REMOVE ME
}
示例3: SepiaToneSample
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public SepiaToneSample() {
ImageView sample = new ImageView(BOAT);
final SepiaTone sepiaTone = new SepiaTone();
sepiaTone.setLevel(0.5d);
sample.setEffect(sepiaTone);
getChildren().add(sample);
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("SepiaTone Level", sepiaTone.levelProperty(), 0d, 1d)
);
// END REMOVE ME
}
示例4: createIconContent
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public static Node createIconContent() {
ImageView iv = new ImageView(BOAT);
iv.setFitWidth(80);
iv.setFitHeight(80);
iv.setViewport(new Rectangle2D(90,0,332,332));
final SepiaTone SepiaTone = new SepiaTone();
SepiaTone.setLevel(1);
iv.setEffect(SepiaTone);
return iv;
}
示例5: GaussianBlurSample
import javafx.scene.image.ImageView; //导入方法依赖的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
}
示例6: start
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 180, 180);
scene.setFill(Color.BLACK);
stage.setScene(scene);
stage.setTitle("Scrollbar");
root.getChildren().addAll(vb, sc);
shadow.setColor(Color.GREY);
shadow.setOffsetX(2);
shadow.setOffsetY(2);
vb.setLayoutX(5);
vb.setSpacing(10);
sc.setLayoutX(scene.getWidth()-sc.getWidth());
sc.setMin(0);
sc.setOrientation(Orientation.VERTICAL);
sc.setPrefHeight(180);
sc.setMax(360);
for (int i = 0; i < 5; i++) {
final Image image = images[i] =
new Image(getClass().getResourceAsStream("fw" +(i+1)+ ".jpg"));
final ImageView pic = pics[i] =
new ImageView(images[i]);
pic.setEffect(shadow);
vb.getChildren().add(pics[i]);
}
sc.valueProperty().addListener((ObservableValue<? extends Number> ov,
Number old_val, Number new_val) -> {
vb.setLayoutY(-new_val.doubleValue());
});
stage.show();
}
示例7: execute
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
* Shows the current image into the screen.
*/
@Override
public void execute() {
getNode().getChildren().remove(getNode().getContainer());
getNode().setMinSize(180,160);
ImageView img = new ImageView(getImage());
img.setFitWidth(140.0f);
img.setFitHeight(120.0f);
img.setEffect(new DropShadow());
getNode().setActionIcon(img);
getNode().getChildren().add( getNode().createContainer() );
setOpenWinEvent();
}
示例8: PerspectiveImage
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public PerspectiveImage(Image image) {
ImageView imageView = new ImageView(image);
imageView.setEffect(ReflectionBuilder.create().fraction(REFLECTION_SIZE).build());
setEffect(transform);
getChildren().addAll(imageView);
}
示例9: MovieCell
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public MovieCell(MovieView movieView) {
this.movieView = movieView;
GridPane gridPane = new GridPane();
ColumnConstraints col1 = new ColumnConstraints();
ColumnConstraints col2 = new ColumnConstraints();
ColumnConstraints col3 = new ColumnConstraints();
ColumnConstraints col4 = new ColumnConstraints();
ColumnConstraints col5 = new ColumnConstraints();
col4.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().setAll(col1, col2, col3, col4, col5);
gridPane.setHgap(10);
// director image
directorImage = new ImageView();
directorImage.setFitWidth(60);
directorImage.setFitHeight(60);
directorImage.setEffect(new InnerShadow());
gridPane.add(directorImage, 0, 0);
GridPane.setRowSpan(directorImage, 2);
GridPane.setValignment(directorImage, VPos.TOP);
// title and year
titleLabel = new Label();
titleLabel.getStyleClass().add("title-label");
gridPane.add(titleLabel, 1, 0);
GridPane.setColumnSpan(titleLabel, 2);
GridPane.setValignment(titleLabel, VPos.TOP);
// director label
directorLabel = new Label();
directorLabel.getStyleClass().add("director-label");
gridPane.add(directorLabel, 1, 1);
GridPane.setValignment(directorLabel, VPos.TOP);
// genre label
genreLabel = new Label();
genreLabel.getStyleClass().add("genre-label");
gridPane.add(genreLabel, 4, 0);
// trailer label
trailerLabel = FontAwesomeIconFactory.get().createIconLabel(FontAwesomeIcon.FILM, "", "14px", "14px", ContentDisplay.GRAPHIC_ONLY);
trailerLabel.getStyleClass().add("trailer-label");
gridPane.add(trailerLabel, 3, 0);
GridPane.setHalignment(trailerLabel, HPos.LEFT);
GridPane.setValignment(trailerLabel, VPos.TOP);
trailerLabel.setOnMouseClicked(evt -> {
try {
Movie movie = getItem();
movieView.setSelectedTrailer(MovieApp.class.getResource("/trailers/" + movie.getTrailer()).toExternalForm());
} catch (NullPointerException e) {
movieView.setSelectedTrailer(MovieApp.class.getResource("/TrailerMissing.mp4").toExternalForm());
}
});
setGraphic(gridPane);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
movieView.useClippingProperty().addListener(it -> updateClipping());
updateClipping();
}
示例10: clickSelectCardHandle
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@FXML
public void clickSelectCardHandle(Event event){
ImageView tmp = (ImageView) event.getSource();
LocatedImage img = (LocatedImage) tmp.getImage();
this.carteClicked = img.getURL();
if(this.carteSelected.contains(img.getURL())){
tmp.setEffect(null);
this.carteSelected.remove( img.getURL());
}else{
DropShadow ds = new DropShadow(20,Color.AQUA);
tmp.setEffect(ds);
this.carteSelected.add( img.getURL());
}
}