-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b142
-
generic
-
generic
-
Verified
The specs for java.awt.RadialGradientPaint says:
=================================================
"Specifying a focus point outside of the circle's radius will result in the focus being set to the intersection point of the focus-center line and the perimeter of the circle."
=================================================
However the following sample shows it does not happen in case of RI.
=================================================
float cx = 0.0f;
float cy = 0.0f;
float radius = 10.0f;
float fx = 20.f;
float fy = 0.0f;
Point2D expectedFocus = new Point2D.Float(10.0f, 0.0f);
RadialGradientPaint gp = new RadialGradientPaint(cx, cy, radius, fx, fy,
new float[] { 0.0f, 0.5f, 1.0f},
new Color[] { Color.RED, Color.GREEN, Color.BLUE },
CycleMethod.NO_CYCLE);
Point2D actualFocus = gp.getFocusPoint();
if ( ! expectedFocus.equals(actualFocus)) {
System.out.println("FAIL. Expected focus point: " + expectedFocus
+ "\nActual focus point: " + actualFocus);
}
=================================================
The output produced:
=================================================
FAIL. Expected focus point: Point2D.Float[10.0, 0.0]
Actual focus point: Point2D.Double[20.0, 0.0]
=================================================
The sample source attached.
=================================================
"Specifying a focus point outside of the circle's radius will result in the focus being set to the intersection point of the focus-center line and the perimeter of the circle."
=================================================
However the following sample shows it does not happen in case of RI.
=================================================
float cx = 0.0f;
float cy = 0.0f;
float radius = 10.0f;
float fx = 20.f;
float fy = 0.0f;
Point2D expectedFocus = new Point2D.Float(10.0f, 0.0f);
RadialGradientPaint gp = new RadialGradientPaint(cx, cy, radius, fx, fy,
new float[] { 0.0f, 0.5f, 1.0f},
new Color[] { Color.RED, Color.GREEN, Color.BLUE },
CycleMethod.NO_CYCLE);
Point2D actualFocus = gp.getFocusPoint();
if ( ! expectedFocus.equals(actualFocus)) {
System.out.println("FAIL. Expected focus point: " + expectedFocus
+ "\nActual focus point: " + actualFocus);
}
=================================================
The output produced:
=================================================
FAIL. Expected focus point: Point2D.Float[10.0, 0.0]
Actual focus point: Point2D.Double[20.0, 0.0]
=================================================
The sample source attached.