Thursday Mar 12, 2009

JavaFX - BlendMode Effect


Just thought of demonstrating use of JavaFX BlendMode effect API to combine and render multiple nodes. Since this requires blending of multiple nodes, we apply this effect to Group by specifying its blendMode attribute.

<script src="http://dl.javafx.com/1.1/dtfx.js"></script> <script src="/rakeshmenonp/resource/BlendMode/BlendMode.js"></script>

For Applet mode, click on right image above.

For standalone mode

Here we create two ImageView and add it to group. The blendMode attribute is bound to one of element of an array of blend modes available in JavaFX. This is done so that we can just change the index to switch to another blend mode.

var blendGroup = Group {
    
    // Specify BlendMode
    blendMode: bind blendMode[index]
    
    content: [
        ImageView {
            image: Image {
                url: "{__DIR__}images/sky.jpg"
            }
        },
        ImageView {
            image: Image {
                url: "{__DIR__}images/baloon.jpg"
            }
        },
    ]
    
    translateX: 5
    translateY: 5
};

Source

<script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script>

About


The views expressed on this blog are my own and do not necessarily reflect that of my organization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today