Making an inverted ellipse morph?

Mark van Gulik ghoul6 at
Mon Dec 4 02:05:53 UTC 2000

on 12/2/00 4:37 PM, Dino at deanmao at wrote:

> Actually, the Form>>replaceColor:withColor: thing doesn't work.  The
> stuff in the drawOn: method uses canvas functions that completely avoid
> drawing the object if the color is transparent.  Simply replacing the
> color with transparency would seem to work, but it doesn't.  If you
> replace the color with transparency, you get a white background.
> It would be cool if somehow we could have boolean operations with shapes
> to get "holes" in shapes...   like circle xor: square...
> Seems like the only way to draw a circle cut out of a square is to do
> the brute force method which I don't really like doing.

In VisualWorks I would do this building a Mask that was the inverted ellipse
shape (worst case, build a regular ellipse on the Mask and invert either its
bits or its palette).  Then I would draw the mask with the appropriate
colored paint onto the final output device.

In Squeak, the following seems to work:

| dot |
dot := Form dotOfSize: 400.
dot offset: 0 at 0.
    copy: (0 at 0 extent: dot extent)
    from: 0 at 0
    in: nil
    rule: Form reverse.
    displayOn: Display
    at: 0 at 0
    clippingBox: (0 at 0 extent: 400 at 400)
    rule: Form oldPaint
    fillColor: Color green

More information about the Squeak-dev mailing list