Fast or Good? (Drop Shadows)

You can run the WebStart demo or, as usual, download its source code.

This new update of the Drop Shadow demo lets you choose between two shadow generation algorithms. By default, the panel will use the fast version. If you tried the first demo, you will see a huge difference when changing the size or the opacity with the sliders. If you uncheck the box at the bottom of the settings panel you will enable the high quality algorithm. I decided to provide both algorithms because of the visual difference:

S├ębastien came up with the fast algorithm and it just rock. On my computer the shadow is generated in 25ms but most of the time is spent duplicating the original picture before actually drawing the shadow. We are confident we can merge the picture copy with the shadow generation to gain even more speed.

The high quality algorithm is the one I showed in my previous post. It uses a convolve operation which results in more computations but a better fidelity. As you can see on the picture above, the fast algorithm has some troubles with the opacity. If you choose a low opacity, between 1% and 30% you will see the shadow is discarded very quickly.

Current implementation of DropShadowPanel should be suited for most of your needs though.

Comments are closed.