• Post Reply Bookmark Topic Watch Topic
  • New Topic

Circle looks bad

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to draw a good looking circle with fillOval(0,0,12,12) but it looks quite bad.
It looks more like a rounded rectangle with little points sticking out.
Even the "Instant Graemlins" in this message board look more circular.
Am I doing something wrong or is this a limitation?
Drew
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i think you should use antialising for smoother edges.
sample1
sample2
(this are the first google results, keywords "java antialiasing")
good luck
kay
 
raj madhuram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It sure looks like a circle to me at 12x12. Maybe if you go smaller, it looks like a rounded rectangle.
One way to make the circle look real smooth is to use anti-aliasing. Refer to the code attached. One shows a circle w/o anti-aliasing and the other with it.
Hope that helps.
regards,
Raj
 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions, but I forgot to mention that I need this to work with Java 1.1, thus no Graphics 2D or Swing...
Drew
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, then you'll have to fake antialiasing yourself... The following code doesn't do perfect antialiasing, but it should give you an idea of what to do...

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate, that does look a lot better.
Although, I can still get a better looking circle in Photoshop.
I might just load a transparent gif of a circle instead...
Drew
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!