[squeak-dev] Round rect drawing

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

[squeak-dev] Round rect drawing

Igor Stasenko
I found that Andreas posted an update recently

Morphic-ar.136.mcz

Proper round rect drawing. Instead of just corner rounding we can now
draw round rects just like any other rectangle with an optional corner
radius, for example:
Display getCanvas frameAndFillRoundRect: (100@100 extent: 200@50)
radius: 10 fillStyle: Color white borderWidth: 2 borderColor: Color
black.


Want to ask, is this a sign of making
  #roundCornersOf:during:
& friends deprecated and use a new direct messages instead whenever it
should be used?


--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Round rect drawing

Andreas.Raab
Igor Stasenko wrote:
> Want to ask, is this a sign of making
>   #roundCornersOf:during:
> & friends deprecated and use a new direct messages instead whenever it
> should be used?

Probably not. #roundCornersOf:during: is a modification to regular
rectangle drawing and works on clients that don't know anything about
supporting round rects explicitly. It would be tricky trying to use
roundRect drawing explicitly everywhere and this really wasn't the
driving use case. The use case was to be able to support round-rect
drawing with a different corner radius / border width than the one and
only supported by corner rounder. For example, compare this:

(RectangleMorph new)
        bounds: (100@100 extent: 200@50);
        color: Color white;
        borderWidth: 5;
        useRoundedCorners;
        fullDrawOn: Display getCanvas.


vs.

(Display getCanvas)
        frameAndFillRoundRect: (100@200 extent: 200@50)
        radius: 20
        fillStyle: Color white
        borderWidth: 5
        borderColor: Color black.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: Round rect drawing

Igor Stasenko
2009/7/24 Andreas Raab <[hidden email]>:

> Igor Stasenko wrote:
>>
>> Want to ask, is this a sign of making
>>  #roundCornersOf:during:
>> & friends deprecated and use a new direct messages instead whenever it
>> should be used?
>
> Probably not. #roundCornersOf:during: is a modification to regular rectangle
> drawing and works on clients that don't know anything about supporting round
> rects explicitly. It would be tricky trying to use roundRect drawing
> explicitly everywhere and this really wasn't the driving use case. The use
> case was to be able to support round-rect drawing with a different corner
> radius / border width than the one and only supported by corner rounder. For
> example, compare this:
>

IMHO, it is a dirty hack to draw rounded shapes, when drawing code
telling you to draw a rectangle.
This is plain wrong, especially for a canvas, who should perform any
actions strictly as they passed from outside by callers.
That's why i would prefer to never see things like
#roundCornersOf:during: again.

> (RectangleMorph new)
>        bounds: (100@100 extent: 200@50);
>        color: Color white;
>        borderWidth: 5;
>        useRoundedCorners;
>        fullDrawOn: Display getCanvas.
>
>
> vs.
>
> (Display getCanvas)
>        frameAndFillRoundRect: (100@200 extent: 200@50)
>        radius: 20
>        fillStyle: Color white
>        borderWidth: 5
>        borderColor: Color black.
>

the last one wins.

> Cheers,
>  - Andreas
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Round rect drawing

Andreas.Raab
Igor Stasenko wrote:
> IMHO, it is a dirty hack to draw rounded shapes, when drawing code
> telling you to draw a rectangle.
> This is plain wrong, especially for a canvas, who should perform any
> actions strictly as they passed from outside by callers.
> That's why i would prefer to never see things like
> #roundCornersOf:during: again.

Try it. It may give some pretty bad artifacts but you won't know before
you try ;-)

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: Round rect drawing

Igor Stasenko
2009/7/24 Andreas Raab <[hidden email]>:

> Igor Stasenko wrote:
>>
>> IMHO, it is a dirty hack to draw rounded shapes, when drawing code
>> telling you to draw a rectangle.
>> This is plain wrong, especially for a canvas, who should perform any
>> actions strictly as they passed from outside by callers.
>> That's why i would prefer to never see things like
>> #roundCornersOf:during: again.
>
> Try it. It may give some pretty bad artifacts but you won't know before you
> try ;-)
>

Tried:

FormCanvas>>roundCornersOf: aMorph in: bounds during: aBlock
        ^ aBlock value


don't see any rounded artifacts :)

> Cheers,
>  - Andreas
>
>



--
Best regards,
Igor Stasenko AKA sig.