Soumen Bhuin
Soumen Bhuin

Reputation: 27

How to get CGAffineTransform from two CGSizes?

Suppose, I have two CGSize named A and B.

Where

B = CGSizeApplyAffineTransform(A, CGAffineTransformMakeScale(x,y));

Now how to calculate x and y if I know A and B?

Upvotes: 0

Views: 109

Answers (1)

Matic Oblak
Matic Oblak

Reputation: 16774

The scale factor for transforming one size to another is simply dividing the target dimension with the current dimension. That means x=B.width/A.width same for height.

Though it is not clear from the question if this is what you wanted, so the solution might as well be x=y=42.

Upvotes: 1

Related Questions