We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Rounded Rectangle Button Class
Page Index Toggle Pages: 1
Rounded Rectangle Button Class (Read 2561 times)
Rounded Rectangle Button Class
Oct 7th, 2009, 5:57pm
 
Not sure if this already exists. But Here's a variation of the button class example in the Processing Handbook by Casey Reas and Ben Fry. I love this book! So easy to read and understand.

http://www.openprocessing.org/visuals/?visualID=5099

Cheers!
Re: Rounded Rectangle Button Class
Reply #1 - Oct 7th, 2009, 9:39pm
 
nice, but I get 1px gaps between the side-rects and the corner-arcs...
Re: Rounded Rectangle Button Class
Reply #2 - Oct 7th, 2009, 9:47pm
 
Really? That's odd. Could you please post a copy of your code so I can take a look?

Thanks.
Re: Rounded Rectangle Button Class
Reply #3 - Oct 8th, 2009, 12:07am
 
I didn't download or modify your code...just noticed this on the openProcessing site you linked.  OSX 10.4.11, Java 1.5, Firefox 2.0.
On close inspection it looks like an aliasing issue.  (Try noSmooth() ?)

...

--Ben
Re: Rounded Rectangle Button Class
Reply #4 - Oct 8th, 2009, 1:11am
 
Isn't that something you usually see when using one of the 3D renderers with smooth()?  Slightly unusual to see it here, perhaps related to graphics card?  An alternative solution might be to draw the rounded rounded rectangle as a solid shape (i.e. calculate appropriate vertices to generate it) rather than as a composite of several shapes, since the lines clearly appear at the borders of the shapes...

For what it's worth it looks fine on my machine, but it's currently in power-saving mode so using the integrated Intel graphics chip...
Re: Rounded Rectangle Button Class
Reply #5 - Oct 8th, 2009, 2:04am
 
I'm on windows with Firefox 3.0.14 and java 6 build 1.6.0_15b03 and it works fine. I'm curious if anyone else is having the same issues and if they wouldn't mind downloading and running from the IDE. I'm curious if it's browser related?

Thanks for feedback anyway guys. You're probably right blindfish about doing it as a solid shape.
Re: Rounded Rectangle Button Class
Reply #6 - Oct 8th, 2009, 4:50am
 
It displays fine in Firefox 3.5, French Windows XP Pro SP3, Java 1.6.0_16, old graphic card.
Re: Rounded Rectangle Button Class
Reply #7 - Oct 9th, 2009, 6:57am
 
Thanks for the info PhiLho,

I think the following link illustrates another way of creating the arcs with Bezier Curves. Maybe I'll try a similar approach when I get some time to explore it again.

http://demonstrations.wolfram.com/BezierCurveApproximationOfAnArc/
Page Index Toggle Pages: 1