Java Reference
In-Depth Information
There's more...
JavaFX supports a multitude of blending options. The following table shows a list of the more
interesting modes:
BlendMode.ADD—adds the color value of the
top image to the bottom
BlendMode.DARKEN—the darker color values of
the child images are displayed
BlendMode.DIFFERENCE—the darker color
values are subtracted from the lighter colors
BlendMode.LIGHTEN—the lighter color values of
the child images are displayed
BlendMode.MULTIPLY—the color values of the
child images are multiplied together
BlendMode.SCREEN—the color values for the
child images inverted, multiplied, and inverted
BlendMode.OVERLAY—the color values can
have the screen or multiplication mode applied
to them depending on the bottom input
BlendMode.COLOR_BURN—the color values of
the bottom layer are divided by that of the top
and then inverted
The BlendedMode class offers more blended modes, including RED , GREEN , BLUE , COLOR_
See also
F Chapter 3—Creating simple animation with the transition API
F Chapter 4—Creating a form with JavaFX controls
F Loading and displaying images with ImageView
Playing audio with MediaPlayer
Playing audio is another important aspect of any rich client platform. One of the celebrated
features of JavaFX is its ability to easily playback audio content. This recipe shows you how to
create code that plays back audio resources using the MediaPlayer class.
Getting ready
This recipe uses classes from the Media API located in the package.
As you will see in our example, using this API you are able to load, configure, and playback
audio using the classes Media and MediaPlayer . For this recipe, we will build a simple
audio player to illustrate the concepts presented here. Instead of using standard GUI controls,
we will use button icons loaded as images. If you are not familiar with the concept of loading
images, review the recipe Loading and displaying images with ImageView in this chapter.
Search WWH ::

Custom Search