Login  Register

Re: Canvas: Transform Width and Height Independently

Posted by Nicolai Hess on Feb 20, 2015; 11:44pm
URL: https://forum.world.st/Canvas-Transform-Width-and-Height-Independently-tp4806749p4806752.html

And there is
FormCanvas>>#warpImage:transform:at:sourceRect:cellSize:
this one works with a MatrixTransform2x3 (this may support scaling for x and y).


2015-02-21 0:40 GMT+01:00 Nicolai Hess <[hidden email]>:
2015-02-20 23:56 GMT+01:00 Sean P. DeNigris <[hidden email]>:
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?


I think there is no direct support in Canvas API.
You can
create a new Form
warpblt into this form
use the canvas to draw the new form



|f|
f:=Form extent:100@400 depth:32.
(WarpBlt current toForm: f)
sourceForm: PolymorphSystemSettings pharoLogoForm destRect: f boundingBox;
combinationRule: Form paint; cellSize:2; warpBits.
f asMorph openInHand




 


-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Canvas-Transform-Width-and-Height-Independently-tp4806749.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.