New Gradients in Java2D

Chris Campbell just blogged about two new gradients available in the Mustang weekly builds, waiting approval by the Mustang JSR executives.

Those new gradients are something I've been wanting for a long time. The first one is the LinearGradientPaint, very similar to the GradientPainte. Yet, it allows you to define multiple colors in the same gradient. This will make many effects much easier/better. The second gradient is even cooler. RadialGradientPaint offers the same features as the previous gradient but performs radial interpolations. Yes, you can finally draw radial gradients with Java2D. Both classes come from Batik, a Java SVG renderer (actually, Chris explains that the code originated from Sun but was donated to Batik.)

Check out the rest of Chris' blog entry as it describes other gems you are most likely to find in Java SE 6 when it comes out.

Comments are closed.