I think that the CornerRounder is not appropriate. It's a hack like its class comment sais. ;-)
What about using the methods from FormCanvas to draw rounded rectangles? The result would be nicer because we could play with anti-aliasing: BUT: Pharo dismissed that interface from canvas and I was wondering, how portable it is. Canvas does not have it. Only FormCanvas has it: frameAndFillRoundRect: aRectangle radius: cornerRadius fillStyle: fillStyle borderWidth: bw borderColor: bc frameRoundRect: aRectangle radius: radius width: borderWidth color: borderColor fillRoundRect: aRectangle radius: radius fillStyle: fillStyle At the moment, PluggableButtons round their corners _without_ the CornerRounder but by using the canvas interface to draw rounded rectangles. Is performance an issue? Well, the corner rounder is quite hacky... Best, Marcel P.S.: The anti-aliasing trick works like this and may be slow: aCanvas frameRoundRect: self bounds radius: 7 width: self borderWidth color: (self borderColor alpha: 0.5). aCanvas frameAndFillRoundRect: self bounds radius: 8 fillStyle: self fillStyle borderWidth: self borderWidth borderColor: self borderColor. aCanvas frameRoundRect: self bounds radius: 9 width: self borderWidth color: (self borderColor alpha: 0.3) |
Nice!
|
In reply to this post by marcel.taeumel (old)
Hi Marcel,
Take a look at #windowFrame:color:radius:border:labelHeight:gradientTop:gradientBottom:insideColor: in Cuis. Besides anti aliasing, it also does gradients. CornerRounder was one of the first things I removed when started Cuis. Cheers, Juan Vuletich Quoting Marcel Taeumel <[hidden email]>: > I think that the CornerRounder is not appropriate. It's a hack like its class > comment sais. ;-) > > What about using the methods from FormCanvas to draw rounded rectangles? The > result would be nicer because we could play with anti-aliasing: > > <http://forum.world.st/file/n4807342/window-corners.png> > > BUT: Pharo dismissed that interface from canvas and I was wondering, how > portable it is. Canvas does not have it. Only FormCanvas has it: > > frameAndFillRoundRect: aRectangle radius: cornerRadius fillStyle: fillStyle > borderWidth: bw borderColor: bc > frameRoundRect: aRectangle radius: radius width: borderWidth color: > borderColor > fillRoundRect: aRectangle radius: radius fillStyle: fillStyle > > At the moment, PluggableButtons round their corners _without_ the > CornerRounder but by using the canvas interface to draw rounded rectangles. > > Is performance an issue? Well, the corner rounder is quite hacky... > > Best, > Marcel > > P.S.: The anti-aliasing trick works like this and may be slow: > > aCanvas > frameRoundRect: self bounds > radius: 7 > width: self borderWidth > color: (self borderColor alpha: 0.5). > > aCanvas > frameAndFillRoundRect: self bounds > radius: 8 > fillStyle: self fillStyle > borderWidth: self borderWidth > borderColor: self borderColor. > > aCanvas > frameRoundRect: self bounds > radius: 9 > width: self borderWidth > color: (self borderColor alpha: 0.3) > > > > -- > View this message in context: > http://forum.world.st/Speaking-of-rounded-corners-tp4807342.html > Sent from the Squeak - Dev mailing list archive at Nabble.com. |
In reply to this post by marcel.taeumel (old)
On 24.02.2015, at 09:02, Marcel Taeumel <[hidden email]> wrote:
> > I think that the CornerRounder is not appropriate. It's a hack like its class > comment sais. ;-) Indeed. > Is performance an issue? It might be. Our window redraws are pretty slow anyway so it might not matter much, but then making it even slower may not be the best idea ;) You also have to watch out for the different border styles a morph can have (OTOH the CornerRounder only handles borders up to 2 pixels wide anyway). A related issue is that we should start to take advantage of higher-resolution displays without pixel-doubling. Squeak looks seriously outdated on a 200 dpi screen. Drawing things properly is a step in that direction. - Bert - smime.p7s (5K) Download Attachment |
Remove_Corner_Rounder.cs
Could somebody please check the attached code? I want to commit it to trunk. As it affects several packages, I preferred to use a change set for now. :) Preferences -> Morphic -> Preferred Corner Radius Best, Marcel |
On Wed, Feb 25, 2015 at 01:35:25AM -0800, Marcel Taeumel wrote:
> Remove_Corner_Rounder.cs > <http://forum.world.st/file/n4807489/Remove_Corner_Rounder.cs> > > Could somebody please check the attached code? I want to commit it to trunk. > As it affects several packages, I preferred to use a change set for now. :) > > Preferences -> Morphic -> Preferred Corner Radius > I loaded the changes with no problem. It looks good to me. The only minor concern would be that the preference for roundedWindowsCorners is in the "windows" preference category, and the new preference for Preferred Corner Radius is in category "Morphic". Should we have them grouped together in the same preference category? Dave |
I think we need multiple categories for that. Otherwise, I would move the "rounded windows" to "Morphic" because the corner radius affects all morphs, not just windows.
Best, Marcel |
In reply to this post by marcel.taeumel (old)
For me, it looks like the fill and the border don't align on the right and bottom side. Moving or resizing a window left some drawing artifacts.2015-02-25 10:35 GMT+01:00 Marcel Taeumel <[hidden email]>: Remove_Corner_Rounder.cs round_corner_fill_and_frame.png (18K) Download Attachment |
Thank you! I missed to check the version with all gradients enabled. Seems to be buggy. I'll fix that! :)
Best, Marcel |
Free forum by Nabble | Edit this page |