javafx.scene.effect.SepiaTone Java Examples

The following examples show how to use javafx.scene.effect.SepiaTone. 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: SepiaToneSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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
}
 
Example #2
Source File: SepiaToneSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: SepiaToneSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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
}
 
Example #4
Source File: SepiaToneSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: Story.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/** render the application on a stage */
  public StackPane createGUI() {

	SwingUtilities.invokeLater(() -> {
		//Simulation.instance().getJConsole().write(ADDRESS,Color.ORANGE,Color.BLACK);
	});

    // place the address content in a bordered title pane.
    Pane titledContent = new BorderedTitledPane(TITLE, getContent());
    titledContent.getStyleClass().add("titled-address");
    titledContent.setPrefSize(800, 745);

    // make some crumpled paper as a background.
    final Image paper = new Image(PAPER);
    final ImageView paperView = new ImageView(paper);
    ColorAdjust colorAdjust = new ColorAdjust(0, -.2, .2, 0);
    paperView.setEffect(colorAdjust);

    // place the address content over the top of the paper.
    StackPane stackedContent = new StackPane();
    stackedContent.getChildren().addAll(paperView, titledContent);

    // manage the viewport of the paper background, to size it to the content.
    paperView.setViewport(new Rectangle2D(0, 0, titledContent.getPrefWidth(), titledContent.getPrefHeight()));
    stackedContent.layoutBoundsProperty().addListener(new ChangeListener<Bounds>() {
      @Override public void changed(ObservableValue<? extends Bounds> observableValue, Bounds oldValue, Bounds newValue) {
        paperView.setViewport(new Rectangle2D(
          newValue.getMinX(), newValue.getMinY(),
          Math.min(newValue.getWidth(), paper.getWidth()), Math.min(newValue.getHeight(), paper.getHeight())
        ));
      }
    });

    // blend the content into the paper and make it look old.
    titledContent.setMaxWidth(paper.getWidth());
    titledContent.setEffect(new SepiaTone());
    titledContent.setBlendMode(BlendMode.MULTIPLY);

    // configure and display the scene and stage.
    //Scene scene = new Scene(stackedContent);
    //scene.getStylesheets().add(getClass().getResource("/css/gettysburg.css").toExternalForm());

/*
    stage.setTitle(TITLE);
    stage.getIcons().add(new Image(ICON));
    stage.setScene(scene);
    stage.setMinWidth(600); stage.setMinHeight(500);
    stage.show();
*/
    // make the scrollbar in the address scroll pane hide when it is not needed.
    makeScrollFadeable(titledContent.lookup(".address > .scroll-pane"));

    return stackedContent;
  }
 
Example #6
Source File: Fallout4MenuApp.java    From FXTutorials with MIT License 4 votes vote down vote up
private Parent createContent() {
    Pane root = new Pane();

    ImageView imageView = new ImageView(new Image(getClass()
            .getResource("res/Fallout4_bg.jpg").toExternalForm()));

    imageView.setFitWidth(1280);
    imageView.setFitHeight(720);

    SepiaTone tone = new SepiaTone(0.85);
    imageView.setEffect(tone);

    Rectangle masker = new Rectangle(1280, 720);
    masker.setOpacity(0);
    masker.setMouseTransparent(true);

    MenuBox menuBox = new MenuBox(250, 350);
    menuBox.setTranslateX(250);
    menuBox.setTranslateY(230);

    MenuBox menuBox2 = new MenuBox(510, 350);
    menuBox2.setTranslateX(250 + 20 + 250);
    menuBox2.setTranslateY(230);

    menuBox.addItem(new MenuItem("CONTINUE", 250));

    MenuItem itemNew = new MenuItem("NEW", 250);
    itemNew.setOnAction(() -> {
        FadeTransition ft = new FadeTransition(Duration.seconds(1.5), masker);
        ft.setToValue(1);

        ft.setOnFinished(e -> {
            root.getChildren().setAll(new LoadingScreen(1280, 720, () -> {
                masker.setOpacity(0);
                root.getChildren().setAll(imageView, menuBox, menuBox2, masker);
            }));
        });

        ft.play();
    });
    menuBox.addItem(itemNew);
    menuBox.addItem(new MenuItem("LOAD", 250));

    MenuItem itemSettings = new MenuItem("SETTINGS", 250);
    itemSettings.setOnAction(() -> {
        menuBox2.addItems(
                new MenuItem("GAMEPLAY", 510),
                new MenuItem("CONTROLS", 510),
                new MenuItem("DISPLAY", 510),
                new MenuItem("AUDIO", 510));
    });

    menuBox.addItem(itemSettings);
    menuBox.addItem(new MenuItem("CREW", 250));

    MenuItem itemExit = new MenuItem("EXIT", 250);
    itemExit.setOnAction(() -> System.exit(0));
    menuBox.addItem(itemExit);

    root.getChildren().addAll(imageView, menuBox, menuBox2, masker);
    return root;
}