[squeak-dev] Drawing rotated rectangles

Jonathan Mullins j.mullins at gmx.com
Wed Nov 16 00:44:11 UTC 2011


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/20111116/2908ee7b/attachment.htm


More information about the Squeak-dev mailing list