Using blend effects
Blending is a way to merge two inputs with different modes. The input can be a ColorInput
, an image, or a regular node. There are 17 different modes of merging. It's hard to find a use case for all of them so I will review only the most often used subset.
Cutting out with the SRC_ATOP blend mode
This blend mode draws only part of the top input lying inside the node it's applied to. By using this, you can get nice clipping effect:

Here, we used the same cosmonaut image as a fill for the "JavaFX"
text:
// chapter8/combining/BlendSrcDemo.java public void start(Stage primaryStage) { Image image = new Image( "https://github.com/sgrinev/mastering-javafx-9-book/blob/master/resources/sample.jpg?raw=true", 300, 300, true, true); ImageInput ii = new ImageInput(image, 0, 0); Blend blend = new Blend(); blend.setMode(BlendMode.SRC_ATOP); blend.setTopInput(ii); Text text = new Text(0, 80, "JavaFX"); text.setFont(Font.font("Verdana", FontWeight...