|
Quick Lists
|
|
Bug ID:
|
6296064
|
|
Votes
|
0
|
|
Synopsis
|
Add new Paint classes for multi-stop gradients
|
|
Category
|
java:classes_2d
|
|
Reported Against
|
1.4
, merlin
|
|
Release Fixed
|
mustang(b81)
|
|
State
|
10-Fix Delivered,
request for enhancement
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4339578
,
4782881
,
6498668
,
6521533
,
6572911
,
6575542
|
|
Submit Date
|
12-JUL-2005
|
|
Description
|
Java2D should provide direct support for multi-color linear and radial gradients. A "reflect" mode should be available in addition to the calmping and cyclic modes currently provided. Although gradients beyond those supplied in Java2D can be implemented in software as custom Paint objects, they can only be fully accelerated if they are made a part of the core API.
Gradients are part of SVG, including SVG Tiny 1.2, as well as other drawing formats and APIs including PostScript Level 3 and OpenVG.
SVG gradients provide the following:
A color ramp with multiple (offset,r,g,b,a) "stops"
A "pad mode" -- clamp, repeat, or reflect
For linear gradients, (x0,y0) and (x1,y1) endpoints
For radial gadients, a center (cx,cy), radius r, and focal point (fx,fy)
I can supply formulas for evaluation the gradient function at an arbitrary point.
xxxxx@xxxxx 2005-07-12 22:17:38 GMT
|
|
Work Around
|
N/A
|
|
Evaluation
|
Application user interfaces on most desktop computers now feature extensive use of multiple stop gradients. XP and OSX use them in a lot of places and Vista will use even more. If Swing applications are to compete with native apps then they need multi-stop gradients too.
Posted Date : 2006-03-23 00:14:26.0
We have added two new concrete Paint implementations for Mustang:
- LinearGradientPaint is a more flexible version of the existing GradientPaint
class that allows for multi-stop gradients involving two or more colors.
- RadialGradientPaint is similarly flexible, except instead of
interpolating the colors in a linear fashion, the colors radiate out
from a center point (imagine ripples expanding from a drop of water).
We are also including a non-user-extendable parent class, MultipleGradientPaint,
which contains shared API and implementation. It also contains two public enums, CycleMethod and ColorSpaceType, which are used to control the behavior of LinearGradientPaint and RadialGradientPaint.
The new API should be familiar to developers who have worked with the multi-stop
gradient classes in the Apache Batik project. Those Batik classes were developed
years ago by Java 2D engineers at Sun and donated to the Batik project. The
classes being integrated into the JDK for Mustang are based on the original
sources from 2000, except with a ton of code and javadoc cleanup. We have
done some work to make the constructors in LGP and RGP a bit more symmetric,
so there are a few constructors in the new JDK classes that weren't in the
Batik classes, and vice versa. The new JDK classes are lacking a number of
performance enhancements made to the Batik code over the years, but we plan
to include some optimizations of our own in the near future. Also, we're
working on accelerating these operations in hardware via OpenGL much as we
did for GradientPaint and TexturePaint, except most likely we will need to
use fragment shaders for these more complex paints.
Along with the new classes, we updated the GradAnim pane in Java2Demo to
demonstrate the new LGP and RGP paint options. In addition, we added some
new options to J2DBench to help folks measure performance of these new
classes.
Posted Date : 2006-04-13 16:53:04.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |