Canvas: Transform Width and Height Independently
Posted by
Sean P. DeNigris on
Feb 20, 2015; 10:56pm
URL: https://forum.world.st/Canvas-Transform-Width-and-Height-Independently-tp4806749.html
I'm implementing a SimpleImageMorph which squeezes the form into the Morph's inner bounds instead of the weird TransformMorph thing.
As a spike, I wrote:
| transform scale |
scale := self innerBounds width / self image width.
transform := MorphicTransform new setScale: scale.
aCanvas warpImage: self image transform: transform at: self innerBounds origin
But obviously this only takes the width into account. How would I transform both of the forms dimensions to the corresponding dimension of the morph's inner bounds?
Cheers,
Sean