Java Reference
In-Depth Information
F Image rotation —the Button instance with the label "Rotate" rotates the image
instance by 90 degrees with each click by setting the imgView.rotate property.
F Image effects —the next five buttons in the code apply effects reflected in their
respective names. These buttons apply the Reflection , Glow , GaussianBlur ,
Lighting (using a PointLight effect), and SepiaTone effects to the image
(only Reflection and Sepia are listed in the code). All buttons work in the same way:
if the effect currently applied to the image is null or the effect is not of the desired
type, then apply the desired effect, otherwise, if the effect is already being applied,
turn it off. This makes the button toggle between its assigned effect.
F Image animation —the last Button control plays the TranslateTransition
instance assigned to the variable anim . The transition animation moves the image
from side-to-side indefinitely until the button is pressed again to stop the animation.
See also
F Chapter 3—Transformation, animations, and effects
F Chapter 4—Components and skinning
F Loading and displaying images with ImageView
Creating image effects with blending
In the previous recipe, we saw how easy it is to build an application that loads, displays,
and applies effects to images. In this recipe, we are going to explore how to create new
visual effects by blending two separate image sources.
Getting ready
For this recipe, you will need to be familiar with the concepts of loading and displaying images
in your application using the Image API. If necessary, review the recipe Loading and displaying
images with ImageView . Part of the code also uses transition animation to slide the images one
on top of the other. If you need to review topics regarding animation, refer to the recipe Creating
simple animation with the Transition API from Chapter 3 , Transformations, Animations, and
Effects . Lastly, the recipe makes use of GUI controls to capture image URLs and action buttons
to apply the effects. If you are not familiar with JavaFX's GUI controls, review the recipe Creating
a form with JavaFX controls from Chapter 4 , Components and Skinning .
Search WWH ::

Custom Search