[squeak-dev] Drawing rotated rectangles

Ricardo Moran richi.moran at gmail.com
Wed Nov 16 01:05:02 UTC 2011


IIRC the argument of the block would be the transformed canvas. So, inside
the block you should refer to it instead of your original "canvas".

Cheers,
Richo

On Tue, Nov 15, 2011 at 9:44 PM, Jonathan Mullins <j.mullins at gmx.com> wrote:

> Hi, I'm wondering if someone could help me with rotating rectangles...
> here is my current code:
>
> drawRectangleFor: aSprite width: aWidth height: aHeight
>
> | o canvas rect |
>
> self createOrResizeTrailsForm. "ensure the form that we'll draw on exists"
>
> o _ (aSprite referencePosition x + 240 )@(180 - aSprite referencePosition
> y).
> canvas _ FormCanvas on: penTrailsForm.
>  rect _ Rectangle origin: o extent: (aWidth at aHeight).
>
> "draw it"
>  canvas frameAndFillRectangle: rect fillColor: aSprite fillColor
> borderWidth: aSprite penSize borderColor: aSprite penColor.
> self changed.
>
>
> I attempted to rotate canvas using transformBy: aDisplayTransform
> clippingTo: aClipRect during: aBlock smoothing: cellSize but I don't
> understand the argument during: aBlock. What code should be passed in
> here? I noticed the block should take one argument called offset.
>
> Cheers, Jonathan
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20111115/0c6789d0/attachment.htm


More information about the Squeak-dev mailing list