Java Code Examples for javafx.scene.effect.BlendMode#MULTIPLY

The following examples show how to use javafx.scene.effect.BlendMode#MULTIPLY . 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: GeometryNodeSnippet.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
protected static Effect createShadowEffect() {
	final DropShadow outerShadow = new DropShadow();
	outerShadow.setRadius(3);
	outerShadow.setSpread(0.2);
	outerShadow.setOffsetX(3);
	outerShadow.setOffsetY(3);
	outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1));

	final Distant light = new Distant();
	light.setAzimuth(-135.0f);

	final Lighting l = new Lighting();
	l.setLight(light);
	l.setSurfaceScale(3.0f);

	final Blend effects = new Blend(BlendMode.MULTIPLY);
	effects.setTopInput(l);
	effects.setBottomInput(outerShadow);

	return effects;
}
 
Example 2
Source File: MvcLogoExample.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private static Effect createShadowEffect() {
	DropShadow outerShadow = new DropShadow();
	outerShadow.setRadius(3);
	outerShadow.setSpread(0.2);
	outerShadow.setOffsetX(3);
	outerShadow.setOffsetY(3);
	outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1));

	Distant light = new Distant();
	light.setAzimuth(-135.0f);

	Lighting l = new Lighting();
	l.setLight(light);
	l.setSurfaceScale(3.0f);

	Blend effects = new Blend(BlendMode.MULTIPLY);
	effects.setTopInput(l);
	effects.setBottomInput(outerShadow);

	return effects;
}
 
Example 3
Source File: GameToken.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
private void createTargetButton() {
	target = (StackPane) lookup("#targetAnchor");
	Image image = IconFactory.getTargetIcon();
	ImageView targetIcon = new ImageView(image);
	targetIcon.setClip(new ImageView(image));
	ColorAdjust monochrome = new ColorAdjust();
	monochrome.setSaturation(-1.0);

	Blend red = new Blend(BlendMode.MULTIPLY, monochrome,
			new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), Color.RED));

	Blend green = new Blend(BlendMode.MULTIPLY, monochrome,
			new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), new Color(0, 1, 0, 0.5)));

	targetButton = targetIcon;

	targetIcon.effectProperty().bind(Bindings.when(targetButton.hoverProperty()).then((Effect) green).otherwise((Effect) red));
	targetButton.setId("target_button");
	hideTargetMarker();
	target.getChildren().add(targetButton);
}
 
Example 4
Source File: BlendEffect.java    From Learn-Java-12-Programming with MIT License 5 votes vote down vote up
public void start1(Stage primaryStage) {
    try {
        BlendMode bm1 = BlendMode.MULTIPLY;
        BlendMode bm2 = BlendMode.SRC_OVER;
        Node[] node = setEffectOnGroup(bm1, bm2);
        //Node[] node = setModeOnGroup(bm1, bm2);
        //Node[] node = setEffectOnCircle(bm1, bm2);
        //Node[] node = setEffectOnSquare(bm1, bm2);
        //Node[] node = setModeOnCircle(bm1, bm2);
        //Node[] node = setModeOnSquare(bm1, bm2);

        GridPane grid = new GridPane();
        grid.setAlignment(Pos.CENTER);
        grid.setHgap(40);
        grid.setVgap(15);
        grid.setPadding(new Insets(20, 20, 20, 20));

        int i = 0;
        grid.addRow(i++, new Text("Circle top"), new Text("Square top"));
        grid.add(node[0],    0, i++, 2, 1);
        GridPane.setHalignment(node[0], HPos.CENTER);
        grid.addRow(i++, node[1], node[2]);
        grid.add(node[3],    0, i++, 2, 1);
        GridPane.setHalignment(node[3], HPos.CENTER);
        grid.addRow(i++, node[4], node[5]);
        Text txt = new Text("Circle opacity - 0.5\nSquare opacity - 1.0");
        grid.add(txt,    0, i++, 2, 1);
        GridPane.setHalignment(txt, HPos.CENTER);

        Scene scene = new Scene(grid, 350, 350);

        primaryStage.setScene(scene);
        primaryStage.setTitle("JavaFX blend effect");
        primaryStage.onCloseRequestProperty()
                .setValue(e -> System.out.println("Bye! See you later!"));
        primaryStage.show();
    } catch (Exception ex){
        ex.printStackTrace();
    }
}
 
Example 5
Source File: DigitFactory.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
private static void applyFontColor(ImageView image, Color color) {
	ColorAdjust monochrome = new ColorAdjust();
	monochrome.setSaturation(-1.0);
	Effect colorInput = new ColorInput(0, 0, image.getImage().getWidth(), image.getImage().getHeight(), color);
	Blend blend = new Blend(BlendMode.MULTIPLY, new ImageInput(image.getImage()), colorInput);
	image.setClip(new ImageView(image.getImage()));
	image.setEffect(blend);
	image.setCache(true);
}
 
Example 6
Source File: BlendEffect.java    From Learn-Java-12-Programming with MIT License 4 votes vote down vote up
public void start2(Stage primaryStage) {
    try {
        BlendMode bm = BlendMode.MULTIPLY;
        //BlendMode bm = BlendMode.SRC_OVER;

        Text txt1 = new Text(bm.name());
        txt1.setX(100);
        txt1.setY(35);

        Text txt2 = new Text("Circle top");
        txt2.setX(70);
        txt2.setY(55);

        Text txt3 = new Text("Square top");
        txt3.setX(160);
        txt3.setY(55);

        Text txt4 = new Text("Circle opacity - 0.5\nSquare opacity - 1.0");
        txt4.setX(70);
        txt4.setY(185);

        Circle c1 = createCircle(80, 95);
        Rectangle s1 = createSquare(80, 95);

        Circle c2 = createCircle(180, 95);
        Rectangle s2 = createSquare(180, 95);

        Pane pane = new Pane();
        pane.setPadding(new Insets(20, 20, 20, 20));
        pane.getChildren().addAll(txt1,txt2,txt3,s1,c1,c2,s2,txt4);
        pane.setBlendMode(bm);

        Scene scene = new Scene(pane, 300, 250);

        primaryStage.setScene(scene);
        primaryStage.setTitle("JavaFX blend effect");
        primaryStage.onCloseRequestProperty()
                .setValue(e -> System.out.println("Bye! See you later!"));
        primaryStage.show();
    } catch (Exception ex){
        ex.printStackTrace();
    }
}