Slick Forums

Discuss the Slick 2D Library
It is currently Wed Nov 26, 2014 1:09 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Mon Jun 15, 2009 4:51 pm 
Offline
Regular
User avatar

Joined: Thu Dec 18, 2008 6:07 pm
Posts: 238
Location: Bournemouth, UK
http://www.netbin.co.uk/external/image? ... 0460218876

The image at the URL above shows the rounded rectangle being drawn stranglely at the corners.

Code:
g.setAntiAlias(true);
      g.setColor(background);
      g.fillRoundRect(this.x, this.y, this.width, this.height, this.height/2);
      g.setColor(border);
      g.drawRoundRect(this.x, this.y, this.width, this.height, this.height/2);
      g.setAntiAlias(false);


I've tried it with a smaller radius and i get the same effect.
Anybody know any reason for this? If not I will post it into the bugs section.

_________________
- Gwinnell (irc.freenode.net, irc.chatspike.net)
- Game Jolt Moderator


Last edited by Gwinnell on Sun Sep 13, 2009 3:49 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 15, 2009 4:58 pm 
Offline
Regular
User avatar

Joined: Thu Dec 18, 2008 6:07 pm
Posts: 238
Location: Bournemouth, UK
It draws fine if I turn anti-aliasing off - but I don't want to do this.

_________________
- Gwinnell (irc.freenode.net, irc.chatspike.net)
- Game Jolt Moderator


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 15, 2009 9:59 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Try changing the number of segments rendered. It looks like you're getting aliasing between the triangles that build up the arcs on the end.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 15, 2009 11:45 pm 
Offline
Regular
User avatar

Joined: Thu Dec 18, 2008 6:07 pm
Posts: 238
Location: Bournemouth, UK
Tried with 1, 2, 5, 20, 50, 100 segments. Also tried with 0, -1, -2, no exceptions thrown on this. -10 segments doesn't seem to load at all. :P

No luck kev, same result.

I think it's because my background color has alpha transparency and some triangles are being drawn twice - hence some areas of the shape are more opaque than the rest.
As a result, there is no issue drawing/filling rounded rectangles that have no alpha transparency.

An updated image:
http://dev.netbin.co.uk/external_image. ... 6649039966

_________________
- Gwinnell (irc.freenode.net, irc.chatspike.net)
- Game Jolt Moderator


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 16, 2009 6:42 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Love the text ;)

Raise a bug, I suggest you use an image anyway, it's going to be way more efficient.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 16, 2009 12:28 pm 
Offline
Regular
User avatar

Joined: Thu Dec 18, 2008 6:07 pm
Posts: 238
Location: Bournemouth, UK
I don't like to use an image. I may decide to change the window size of the game.

Just a pointer to anybody else with this problem...
Using ShapeRenderer.fill(shape) seems to work fine.

_________________
- Gwinnell (irc.freenode.net, irc.chatspike.net)
- Game Jolt Moderator


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 16, 2009 12:47 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
You could use an image with a center and two ends like most GUIs do. Stretch the centre pieces as wide as you like and add the two curved ends.

Drawing that geometry is pretty slow in comparison to draw 3 images.

Kev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group