I have been playing with JavaFX recently, and it has to be said that I’ve been having a really pleasant time. The API is really well documented, and the code itself is simple, intuitive and easy get the hang of.
I was pleasantly surprised when I came to read the Reflection Documentation to find that adding reflections to Nodes is in fact a single line. It really is as simple as this:
ImageView imView = new ImageView(); imView.setEffect(new Reflection());
And now your ImageView has a reflection applied to it!
Unfortunately however, this addition revealed something not so desirable in the output. Here’s a screenshot:
As you can see, there are two ImageViews that overlap, with the one on the right obscuring half of the one on the left. This isn’t reflected on the reflections however, as the middle of the two images merge together incorrectly. The fix should be quite simple, the reflections just need to be cropped to the visible area of the Nodes that they reflect.
I have created a bug report, so hopefully there will be a fix in the future!
I have written several articles on converting our Java3D usage into JavaFX and you can read the other articles here.
Latest posts by Leon Atherton (see all)
- How to fill shapes on HTML5 Canvas using EvenOdd winding rule - September 4, 2013
- Measure content performance with Analytics – Why convert PDF magazines to HTML5? Part 7 - July 9, 2013
- Images in SVG: Beware of Aspect Ratio! - June 27, 2013
- What is the optimum number of lines of code written per day? - June 13, 2013
- Improving the way settings get passed in ExtractPagesAsHTML - May 30, 2013