Lightening and darkening

The BlendMode chooses the lighter (or darker, respectively) component of the two sources and uses it to produce the result. In the following screenshot, both inputs are blended with the same white-to-black gradient:

The code is pretty similar, but note we are using ColorInput for the first time in this book:

// chapter8/combining/LightAndDarkDemo.javapublic void start(Stage primaryStage) {    VBox root = new VBox(10);    root.setPadding(new Insets(10));    final Image image = new Image("https://raw.githubusercontent.com/sgrinev/mastering-javafx-9-10-book/master/resources/sample.jpg", 200, 200, true, true); Stop[] stops = new ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.