Speaking of rounded corners...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Speaking of rounded corners...

marcel.taeumel (old)
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)
Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

timfelgentreff
Nice!
Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

J. Vuletich (mail lists)
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.




Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

Bert Freudenberg
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
Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

marcel.taeumel (old)
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
Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

David T. Lewis
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


Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

marcel.taeumel (old)
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
Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

Nicolai Hess
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
<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

Best,
Marcel



--
View this message in context: http://forum.world.st/Speaking-of-rounded-corners-tp4807342p4807489.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.





round_corner_fill_and_frame.png (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Speaking of rounded corners...

marcel.taeumel (old)
Thank you! I missed to check the version with all gradients enabled. Seems to be buggy. I'll fix that! :)

Best,
Marcel