[squeak-dev] raised bordered ellipse

Eduardo Ochs eduardoochs at gmail.com
Mon Mar 6 18:23:20 UTC 2023


Hi Lauren,

can you send detailed instructions for how to run your code?
I will need to learn how to use canvases soon(*) and your
code looks like a good starting point...

  Thanks in advance! =)
    Eduardo Ochs
    http://anggtwu.net/eev-squeak.html


(*): actually I tried to write a drawing program a few weeks
ago, but that turned out to be far above my level, and I am
still working on debugging tools and on ways to organize my
note... =(


On Sun, 5 Mar 2023 at 03:07, Lauren Pullen <drurowin at gmail.com> wrote:

> Hi List,
>
> After much pulling of my hair out on how to make GradientFillStyle work,
> I managed to get an EllipseMorph with a raised border.
>
> I've brute forced it by calling fillOval: twice; first call for the
> border, then again for the innards.  FormCanvas and BalloonCanvas do not
> draw the same ellipse, scaled; the difference at a small radius is quite
> noticeable.
>
> Here is the code I've got.  It only works with opaque filling, but
> that's all I need it to work with.  (I mean, it doesn't crash... but
> it's certainly wrong.)  I think I got the border width math correct?
> How would List tackle this?
>
> drawOn: aCanvas
>    "manual drawing of RaisedBorder oval"
>
>    aCanvas isShadowDrawing
>       ifTrue: [^ super drawOn: aCanvas].
>    aCanvas
>    "draw the border"
>       fillOval: self bounds
>       fillStyle: ((GradientFillStyle ramp: {
>             0.2 -> (self color mixed: 0.65 with: Color white).
>             0.5 -> (self color).
>             0.8 -> (self color mixed: 0.7 with: Color black)})
>          origin: self bounds origin;
>          direction: self extent;
>          radial: true);
>    "fill the inside"
>       balloonFillOval: ((self bounds origin + (self borderWidth))
> corner: self bounds corner - (self borderWidth))
>       fillStyle: self color
>       borderWidth: 0
>       borderColor: Color transparent
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230306/3e17dcf5/attachment.html>


More information about the Squeak-dev mailing list