Login  Register

Re: Canvas: Transform Width and Height Independently

Posted by stepharo on Feb 21, 2015; 11:06am
URL: https://forum.world.st/Canvas-Transform-Width-and-Height-Independently-tp4806749p4806785.html

Sean
Could you write a little doc on what you learned?
I would love to read it.

Stef
Le 21/2/15 04:50, Sean P. DeNigris a écrit :

> Sean P. DeNigris wrote
>> That worked
> But actually, it was totally unnecessary! MorphicTransform's scaling method
> arguments were either named (unhelpfully) 's' or (misleadingly) 'aFloat',
> but apparently, I can just pass aPoint to scale x and y separately :)
>
> So I'm back to the simple version...
> drawOn: aCanvas
>
> | transform widthScale heightScale |
> widthScale := self innerBounds width / self image width.
> heightScale := self innerBounds height / self image height.
> transform := MorphicTransform new withScale: widthScale@heightScale.
> aCanvas warpImage: self image transform: transform at: self innerBounds
> origin
>
> Thanks for talking me through it! I learned a lot...
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Canvas-Transform-Width-and-Height-Independently-tp4806749p4806767.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>