-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b81
-
generic, x86
-
generic, windows_2000
A DESCRIPTION OF THE REGRESSION :
When using java.awt.Graphics.drawRoundRect() to draw rectangles with rounded corners to an offscreen image, the rectangles look uneven, and in some cases a pixel in the top left curve is drawn above the top edge of the rectangle.
The bug seems to only appear when drawing offscreen, drawing directly to the screen looks OK, but for a larger application the lack of double buffering can introduce flickering in the UI.
REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.ImageObserver;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class RoundRectTest extends Frame implements ImageObserver
{
private Image _offscreen;
public static void main(String args[])
{
new RoundRectTest().show();
}
public RoundRectTest()
{
super("RoundRect bug demonstration");
setBounds(0,0,200,200);
addWindowListener(new OnClose());
}
public void paint(Graphics g)
{
if (_offscreen == null)
_offscreen = createImage(200, 200);
Graphics off = _offscreen.getGraphics();
off.setColor(Color.green);
off.fillRoundRect(50, 50, 100, 100, 7, 7);
off.setColor(Color.red);
off.drawRoundRect(50, 50, 100, 100, 7, 7);
off.dispose();
g.drawImage(_offscreen, 0, 0, this);
}
public boolean imageUpdate(Image img, int info, int x, int y, int w, int h)
{
// Not loading dynamically, so can safely assume the whole image is there now.
return false;
}
public class OnClose extends WindowAdapter
{
public void windowClosing(WindowEvent e) {
dispose();
}
}
}
RELEASE LAST WORKED:
5.0 Update 6
RELEASE TEST FAILS:
mustang-beta
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect a Rectangle with consistent curves in all four corners.
In 1.1 JVMs, this was the case, but in 1.2 - 1.5 JVMs, bug #4151279 caused some flatness of the curves. According to the bug report, this was fixed in mustang b53, which I suspect is where this bug crept in.
ACTUAL -
With a corner radius of 7,7, the top left corner has a pixel sticking up above the rectangle.
With a corner radius of 8,8, there are no pixels sticking up, and the curves look smoother than in 1.5, but the top left corner is noticeably smaller than bottom right, and the top right and bottom left corners are distorted slightly.
It appears that there is an off-by-one bug in the calculations for the top and left edges.
APPLICATION NAME: AltioLive Studio APPLICATION VERSION: 4.2.0
OBSERVED APPLICATION IMPACT:
AltioLive 4.2 allows the use of 3D, Flat and Rounded control styles. When the Rounded control style is selected, it is aesthetically displeasing. The inability of developers to use this style makes Java based applications uncompetitive with .NET, Flash and AJAX based applications for developing "Web 2.0" applications where this rounded corner look is prevalent.
When using java.awt.Graphics.drawRoundRect() to draw rectangles with rounded corners to an offscreen image, the rectangles look uneven, and in some cases a pixel in the top left curve is drawn above the top edge of the rectangle.
The bug seems to only appear when drawing offscreen, drawing directly to the screen looks OK, but for a larger application the lack of double buffering can introduce flickering in the UI.
REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.ImageObserver;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class RoundRectTest extends Frame implements ImageObserver
{
private Image _offscreen;
public static void main(String args[])
{
new RoundRectTest().show();
}
public RoundRectTest()
{
super("RoundRect bug demonstration");
setBounds(0,0,200,200);
addWindowListener(new OnClose());
}
public void paint(Graphics g)
{
if (_offscreen == null)
_offscreen = createImage(200, 200);
Graphics off = _offscreen.getGraphics();
off.setColor(Color.green);
off.fillRoundRect(50, 50, 100, 100, 7, 7);
off.setColor(Color.red);
off.drawRoundRect(50, 50, 100, 100, 7, 7);
off.dispose();
g.drawImage(_offscreen, 0, 0, this);
}
public boolean imageUpdate(Image img, int info, int x, int y, int w, int h)
{
// Not loading dynamically, so can safely assume the whole image is there now.
return false;
}
public class OnClose extends WindowAdapter
{
public void windowClosing(WindowEvent e) {
dispose();
}
}
}
RELEASE LAST WORKED:
5.0 Update 6
RELEASE TEST FAILS:
mustang-beta
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect a Rectangle with consistent curves in all four corners.
In 1.1 JVMs, this was the case, but in 1.2 - 1.5 JVMs, bug #4151279 caused some flatness of the curves. According to the bug report, this was fixed in mustang b53, which I suspect is where this bug crept in.
ACTUAL -
With a corner radius of 7,7, the top left corner has a pixel sticking up above the rectangle.
With a corner radius of 8,8, there are no pixels sticking up, and the curves look smoother than in 1.5, but the top left corner is noticeably smaller than bottom right, and the top right and bottom left corners are distorted slightly.
It appears that there is an off-by-one bug in the calculations for the top and left edges.
APPLICATION NAME: AltioLive Studio APPLICATION VERSION: 4.2.0
OBSERVED APPLICATION IMPACT:
AltioLive 4.2 allows the use of 3D, Flat and Rounded control styles. When the Rounded control style is selected, it is aesthetically displeasing. The inability of developers to use this style makes Java based applications uncompetitive with .NET, Flash and AJAX based applications for developing "Web 2.0" applications where this rounded corner look is prevalent.
- duplicates
-
JDK-6385313 REGRESSION: VM crash on launching application with splash screen
-
- Closed
-