Submitted On 18-NOV-1998
rmyorston
This is no doubt related to 4179437.
I don't agree that the circles look good enough.
I use small circles in my applets and with JDK
1.2 RC1 they come out looking like diamonds when
drawn into an offscreen buffer. The legend of my
map doesn't use an offscreen buffer and the shape
of the markers there is quite different.
Submitted On 19-NOV-1998
pbonneau
The small circles look particularly ugly with a radius of 6 (JDK 1.2 RC1)
Submitted On 04-JAN-1999
gezelter
Circles are still unusably bad for my
chemistry viewer when atom sizes get small.
Submitted On 13-JAN-1999
gezelter
If you want to talk directly to the underlying
Graphics2D object in 1.2, using RenderingHints
can help make the filled circle output more
palatable:
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
Submitted On 12-JUL-1999
lotusalife
Sun circles are of terrible quality (JDK 1.2.2)
drawOval is just as badly afflicted as fillOval.
fillOval(a,b,c,d) followed by fillOval(a,b,c,d)
to my amazement produces visible gaps between the two circles!
Submitted On 08-NOV-1999
shinsato
The fact that the quality of circle painting degraded from JDK 1.1 to JDK 1.2
is putting java in a poor light in our company. Sun, please address this
problem.
This is not "good enough" for our quality assurance team. Please
help us make
a good Java product by fixing this problem in the next JDK 1.2 update release.
Submitted On 22-JUN-2001
rmyorston
Happy birthday 4151279!
Three long years of 'good enough' circles.
Submitted On 13-FEB-2002
paul_bailey
I have circles up now that are nowhere near "good enough". I
have a "circle" that is 17 pixels across and has two
sections that are 8 pixels long and straight. This is
pathetic! (yes, i draw off screen).
This is not a circle:
xxxxxxxx
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
xxx xx
xxx
(if you are not using a monotype font, this will not look
right, you should be able to copy and paste or change your
browser settings).
See if the html makes it
<pre>
xxxxxxxx
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
xxx xx
xxx
</pre>
Submitted On 14-FEB-2002
rmyorston
Between 1.4.0.beta2 and 1.4.0.beta3 the circles got better,
on Linux, at least. And they still look good in 1.4.0
final. It's just a shame that the enormous number of broken
runtimes out there mean that my code will need to continue
to be bloated with workarounds for this issue.
Submitted On 19-APR-2002
mleroux01
This should have been fixed long ago. I should be able to
draw a perfectly round circle in a panel or in an
offscreen image which gets drawn in that panel. As the
following code demonstrates, the offscreen image contains
things that aren't quite circles:
import java.awt.*;
import java.awt.Image;
import java.applet.*;
public class sample extends Applet {
myPanel p1;
Image img;
Graphics off;
myPanel2 p2;
public void init() {
img = createImage(200, 200);
off = img.getGraphics();
p1 = new myPanel(img);
p1.setSize(200, 200);
p2 = new myPanel2();
p2.setSize(200, 200);
this.setLayout( new GridLayout(0,2) );
this.add(p1);
this.add(p2);
}
}
class myPanel extends Panel {
Image img;
Graphics off;
public myPanel() {
super();
this.init();
}
public myPanel(Image i) {
img = i;
this.init();
}
public void init() {
off = img.getGraphics();
off.setColor(Color.black);
off.fillRect(0, 0, 200, 200);
off.setColor(Color.red);
off.drawOval(100, 100, 10, 10);
off.drawOval(70, 70, 20, 20);
off.drawOval(20, 20, 50, 50);
}
public void paint(Graphics g) {
if (img != null) {
g.drawImage(img, 0, 0, img.getWidth(this),
img.getHeight(this), this);
}
}
}
class myPanel2 extends Panel {
public void paint(Graphics g) {
g.setColor(Color.white);
g.fillRect(0, 0, 200, 200);
g.setColor(Color.blue);
g.drawOval(100, 100, 10, 10);
g.drawOval(70, 70, 20, 20);
g.drawOval(20, 20, 50, 50);
}
}
Submitted On 22-MAY-2002
paul_bailey
still no new evaluation,argh!
Submitted On 07-JUN-2002
jerryj
Sun considers this bug report to be the 'master' bug report
for rasterizer problems, but so far has failed to update
this bug report to reflect this fact (see the comments in
bug 4092170 for a discussion).
So here goes: drawArc, fillArc, drawOval, fillOval,
drawRoundRect, fillRoundRect, drawPolygon, fillPolygon when
drawn to an offscreen buffer will yield different
areas/outlines than when drawn directly to an onscreen
Graphics object.
Results: ovals and round rects with square corners, etc.
If you are doing any type of double buffering and the
output looks different then without double buffering, this
is probably your bug.
Here is an example that yields SQUARE corners in a drawOval
() and drawRoundRect():
--------------------------------------------------
import java.awt.*;
public class drawrectbug extends Frame {
public static void main(String[] args) {
new drawrectbug();
}
public drawrectbug() {
super("drawRoundRect/drawOval bugs");
resize(400,300);
show();
}
public boolean handleEvent( Event evt ) {
if (evt.id==Event.WINDOW_DESTROY) {
System.exit(0);
}
return super.handleEvent(evt);
}
public void paint(Graphics g) {
Image i = createImage(size().width, size().height);
drawAll( i.getGraphics(), 50 );
g.drawImage( i, 0, 0, null );
drawAll( g, 100 );
g.setColor( Color.black );
g.drawString( "buffered:", 10, 60 );
g.drawString( "direct:", 10, 110 );
}
private void drawAll( Graphics g, int y ) {
g.setColor( Color.yellow );
g.fillRoundRect( 80, y, 30, 20, 6, 6 );
g.fillOval( 150, y, 6, 6 );
g.setColor( Color.black );
g.drawRoundRect( 80, y, 30, 20, 6, 6 );
g.drawOval( 150, y, 6, 6 );
}
}
--------------------------------------------------
Submitted On 11-JUN-2002
jerryj
"g.drawOval(0,0,6,6)" under Java 1.0 or Java 1.1:
00112233445566
0 XXXXXX
1 XX XX
2 XX XX
3 XX XX
4 XX XX
5 XX XX
6 XXXXXX
"g.drawOval(0,0,6,6)" under Java 1.3 or Java 1.4:
00112233445566
0 XXXXXXXXXXXX
1 XX XX
2 XX XX
3 XX XX
4 XX XX
5 XXXX XX
6 XXXXXX
Not pleasing? Or a bug that should be fixed. Write to Sun
and let them know what you think.
Submitted On 22-NOV-2002
mleroux01
Better yet, use all three of your bug votes on the left
sidebar for this bug to bump it up the queue! The number is
4151279.
Submitted On 11-DEC-2002
paul_bailey
4 years since the last evaluation, who should we write to at
sun?
Submitted On 16-APR-2003
mleroux01
Four years is ridiculous. Sun, fix this damn bug!
Submitted On 25-MAY-2003
msundman
"who should we write to at sun?"
Perhaps java2d-comments@java.sun.com ?
Submitted On 28-AUG-2003
mleroux01
How many years will we have to wait?
Submitted On 02-SEP-2003
jozart
Update: I turned off the outline to have a closer look. The
offscreen ellipse filling does look better than the outline. It
doesn't look as good as the onscreen version, but it's
probably adequate.
So if you can bring the offscreen outline "in-line" with the
offscreen filling, then Ellipse2D will be adequate for my needs.
Submitted On 02-SEP-2003
jozart
I run into this problem when trying to render filled and
outlined ellipses into a back buffer. (On Win2K & WInXP.)
The problems are:
1. Both outlined and filled ellipse looked bad (angular,
asymmetric) when drawn to offscreen buffer.
2. Ellipse filling did not touch outline in some places;
and in other places, filling bled through outline.
3. Neither the offscreen ellipse outline nor filling matched
the onscreen version.
My test applet is below.
In my test, I tried applying a value-quality hint but
it doesn't help.
Using anti-alias is not an option (too fuzzy, etc.)
/* EllipseTest.java */
import java.awt.*;
import java.awt.geom.Ellipse2D;
/** Tests Graphics2D ellipse. */
public class EllipseTest extends java.applet.Applet {
public void init() {
setLayout(new java.awt.BorderLayout());
}
public void paint(Graphics g) {
// on screen
g.setColor(Color.BLUE);
g.drawRect(5, 5, 90, 90);
Graphics2D g2 = (Graphics2D) g;
Shape s = new Ellipse2D.Double(5, 5, 90, 90);
g2.setPaint(Color.RED);
g2.fill(s);
g2.setPaint(Color.BLACK);
g2.draw(s);
// off screen
Image image = createImage(100, 100);
Graphics gi = image.getGraphics();
gi.setColor(Color.BLUE);
gi.drawRect(5, 5, 90, 90);
Graphics2D gi2 = (Graphics2D) gi;
gi2.setPaint(Color.RED);
gi2.fill(s);
gi2.setPaint(Color.BLACK);
gi2.draw(s);
g2.drawImage(image, 100, 0, this);
}
}
Submitted On 10-SEP-2003
LavKovacic
This bug is 5 years old, and it is still not corrected?
If it is so difficult to write this correction, you could at least
rename the object Ellipse2D to Potato2D, so you don't need
to write correction at all :-).
Submitted On 05-DEC-2003
andrewHall
Just come across this problem and can't believe that it
has now passed it's 5th birthday! It seems to have
been fixed on Linux but on Windows those same small
circles are looking pretty deformed.
Anyone know a good work-around which isn't too
compute intensive?
Submitted On 16-DEC-2003
rneely007
I'm drawing Ovals using a polygon and simply
computing the points. On the screen the ovals are
nice and smooth, but when sent to the printer their
shape is slightly distored. If few points are used, the
printed oval becomes slightly boxey. But if a large
number of points are used, the printout will show very
jagged edges like a piece of serrated metal!
double radians = 0.0;
for (int i=0; i<numPoints; i++) {
xPoints[i] = width * Math.cos(radians);
yPoints[i] = height * Math.sin(radians);
radians += (2.0 * Math.PI) / numPoints;
}
Submitted On 07-JAN-2004
mleroux01
Five and a half years of waiting now. I'll have to teach
myself Java again to remember why I wanted this fixed so
badly. Should we throw a party in June when this bug turns six?
Submitted On 08-MAR-2004
singer_regnis_de
Whenever this bug will be fixed?
Submitted On 24-APR-2004
verdyp
I don't understand the need to go through a Bezier and
then approximate points, when drawing ovals and
circles is a known algorithm which can be
implemented cleanly using only integer arithmetic.
I understand that using Beziers may improve the
performance for large circles where the difference
isnearly invisible, but for small circles, an integer-
based incremental algorithm already exists since long
and there are many historic books that demonstrate
how to do this cleanly and fast..
Submitted On 24-MAY-2004
verdyp
Bibliography of methods used to draw circles and arcs incrementally (hope this helps):
[BRE77] Bresenham, J.E. "A Linear Algorithm for Incremental Digital Display of Circular Arcs", CACM, 20(2):100-106, February 1977.
[COH69] Cohen, D. "On Linear Difference Curves", Dept. Eng. Appl. Math., Harvard Univ. 1969. Also in "Computer Display Review, see [KEY66].
[PIT67] Pitteway, M.L.V.: "Algorithm for Drawing Ellipses or Hyperbolae with a Digital Plotter", Comput. J., 10(3):282-289, November 1967.
[KEY66] Keydata Corporation, "Computer Display Review", KeyData Corp., Watertown, MA. This review was published annually beginning in 1966, and consisted of reviews of display hardware and selected articles on graphical techniques. Individual articles were retained for several years. The review is now published periodically by GML Associates, 594 Marrett Rd., Lexington, MA. Articles on graphical techniques are contained in volume 4.
As you see this has been studied since long, and lots of articles and books have been published on computer graphics. Drawing circles correctly should no more be a problem, and there are LOTS of various implementations on as many platforms.
Submitted On 06-JUL-2004
mthornton
The likely reason for using Bezier curves to draw circles is to keep down the number of special cases (and thus code bloat). Remember that if the transform matrix is not just a scale and shift (i.e. includes a shear) component, then the result of drawing a 'circle' is rather different. So the Bezier approach is needed to cope with general transforms. Yes, a special case renderer could be used when the transform is simple, but that would be extra code which they understandably want to avoid if adequate quality can be achieved by the more general Bezier approach.
Submitted On 24-AUG-2004
Rene Grothmann
I never noticed this bug, since I am always using anti-aliasing in Java 1.4. Looks much better. I cannot find it "fuzzy" at all. Maybe that is due to my flatscreen.
However, I am not writing to tell you this. You can easily program around making your own circle routine. For circles with less than 5 pixels of radius, you can just as well use a sexagon.
Finally, I would urge Sun to fix this, for it is ridiculous. The kind of thing you are spreading if you want to make Java look bad.
Submitted On 08-SEP-2004
andrewHall
Does anyone at Sun ever look at these outstanding bugs? This bug makes graphical Java programs look very amateurish on Microsoft operating systems just when it really needs to look at its best; it is a very poor advertisement for Java. I may be wrong but it would also seem to be a very straightforward one to fix being just a simple algorithm.
It is not just a problem with small circles although it is more obvious with them and the polygon work-around is too inefficient for the bigger ones. If there was an efficient pixel painting method I would write a Bresenham algorithm myself, but there isn't.
Does anyone know of a more efficient work-around?
Submitted On 08-SEP-2004
andrewHall
Should have mentioned that it all appears to work perfectly on Linux and Solaris operating systems.
So why is it such a problem to get it right on Windows?
We have now been waiting 6 years since that evaluation.
Submitted On 08-SEP-2004
andrewHall
One last thing, I'll try a bit of extortion: if this bug doesn't get fixed in the next release I am porting my app to C#. ;-)
Submitted On 27-SEP-2004
alex_2d
We are actively working on a fix of this bug. At the moment we are considering two potential solution:
- Improving our flattening algorithm by adding intelligent rounding
- Creating special casing for curves and ovals using incremental algorithms
Submitted On 09-FEB-2005
mleroux01
Six years and seven months now.
Submitted On 19-FEB-2005
mgrev
Good on you guys for getting this into mustang. Just make sure it
Submitted On 19-FEB-2005
mgrev
So will you ever fix the bug that cuts a text at the first single-quote?
Submitted On 19-FEB-2005
mgrev
... just make sure it works fast with anti aliasing, since that will be the largest use case in the future.
Submitted On 21-FEB-2005
alex_2d
Dear Mgrev,
Could you please provide us more info about bug which cuts a text at the first single-quote. Does it have bug id or you just have a test case ? If the problem is not filed in our database please report about it or send us example of code showing incorrect behavior.
Submitted On 02-APR-2005
AlexLamSL
I think he (mgrev) is referring to the fact that comments are often cut off right HERE, the Bugs Database interface itself! ^^"
Submitted On 12-APR-2005
AlexLamSL
Just out of interest - are we expecting the improved routines to appear in Mustang btw?
Submitted On 18-APR-2005
alex_2d
Yes, we are trying to get the fix into Mustang.
Submitted On 18-APR-2005
AlexLamSL
cool~ \(^0^)/
looking forward to that
Submitted On 15-AUG-2005
mrpeets
We do a lot of PLAF/skin work with small radius circles, and we have three issues, which we are still seeing in 1.4.2_07 and 1.5:
1. small circles look awful (radius < 10)
2. circular corners in round rects look different from circles
3. circular corners in round rects look different depending on which corner they are placed
It's really, really bad. Frustrating. Disappointing. The circles look like crap. *** PLEASE FIX IN MUSTANG!!! DON'T MAKE US SUFFER ANY LONGER!!! ***
Submitted On 07-SEP-2005
AlexLamSL
looks like even the JSR166x maintenance update has made itself into Mustang now; being rather courious - what are the actual problems that the "separate pipeline" is facing?
Submitted On 12-SEP-2005
mleroux01
Seven years, two months and counting.
Submitted On 20-SEP-2005
msundman
It took 7 years and 3 months to fix this bug! And this was one of the most popular bugs. Does this mean that the time to fix some of the less popular bugs will be measured in decades?
Submitted On 08-OCT-2005
mleroux01
The output looks better in Mustang b55 but it is not perfect. Circles drawn in offscreen buffers look more like rounded ovals. This could still use some improvement.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|