2015-02-05 6:29 GMT+01:00 Sean P. DeNigris <sean@clipperadams.com>:
The following works as I expect:

�� �� �� �� morph := Morph new
�� �� �� �� �� �� �� �� topLeft: 200@400;
�� �� �� �� �� �� �� �� openInWorld.

�� �� �� �� outputRect := morph fullBounds.
�� �� �� �� canvas := Display defaultCanvasClass extent: outputRect extent depth:
Display depth.
�� �� �� �� scale := 1.
�� �� �� �� t := MorphicTransform offset: outputRect topLeft angle: 0 scale: scale.
�� �� �� �� clipRect := outputRect translateBy: outputRect topLeft negated.
�� �� �� �� canvas transformBy: t clippingTo: clipRect during: [ :aCanvas |
�� �� �� �� �� �� �� �� aCanvas fullDrawMorph: morph ].
�� �� �� �� canvas form asMorph openInWindow.

�� �� �� �� "morph delete."

but if I change scale even a little bit (e.g. 0.95), things quickly go
south.
Check out scale = 1 vs scale = 0.95 below:
<http://forum.world.st/file/n4803830/Screenshot_2015-02-05_00.png>
Obviously they differ by more than I expected. If I change scale to 0.5, the
morph disappears from view in the canvas completely.

I had both translation and scale working in a spike by translating with
FormCanvas>>#translateBy:during: and then magifying with "canvas form
magnifyBy: 0.5", but I want to do this in my morph's drawing method, so I
want to do both with the canvas.

Where am I going wrong here?



The scaling factor changes the effective coordinates of the morph
Morph topLeft 200@400
scale 0.5
Morph draws itself at 100@200
Therefore your MorphicTransform translates to far away (or not far enough?)

���������� morph := EllipseMorph new
������������������������������ topLeft: 200@400;
������������������������������ openInWorld.

�������������� outputRect := morph fullBounds.
�������������� canvas := Display defaultCanvasClass extent: outputRect extent depth: Display depth.
�������������� scale := 0.5.

�������������� "scale the offset of the translation too"
�������������� t := MorphicTransform offset: outputRect topLeft * scale angle: 0 scale: scale.
�������������� clipRect := outputRect translateBy: outputRect topLeft negated.
�������������� canvas transformBy: t clippingTo: clipRect during: [ :aCanvas |
������������������������������ aCanvas fullDrawMorph: morph ].
�������������� canvas form asMorph openInWindow.
�������������� morph delete.


What do you want to achieve?
Both
magnifyBy: and
transformBy:clippingTo:during:�� (with non-pure-translation)

actually do the same, they warp-blitting a form.




��





-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Canvas-Transform-Goes-Haywire-if-Scaled-tp4803830.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.