Re: NSAffineTransform
Re: NSAffineTransform
- Subject: Re: NSAffineTransform
- From: Lorenzo <email@hidden>
- Date: Mon, 25 Oct 2004 08:40:35 +0200
Hi thanks.
May you please show me the code? I ask so because I tried several
approaches, and finally I have got one which works but it's not so fine.
I create a copy of the original bezier(s) then when dragging I create
continuosly a new bezier with the new scale. I guess this is not a fine
method. What do you think?
newBezier = [originalBezier copy];
while(mouseDrag){
NSAffineTransform *aTransform = [NSAffineTransform transform];
xFactor = newX / oldX;
[aTransform scaleXBy:xFactor yBy:1.0];
newBezier = [aTransform transformBezierPath:originalBezier];
[self DrawBezier:newBezier];
// until mouseUp
}
originalBezier = [newBezier copy];
Best Regards
--
Lorenzo
email: email@hidden
>
From: Graham Cox <email@hidden>
>
Date: Mon, 25 Oct 2004 08:33:33 +1000
>
To: Lorenzo <email@hidden>
>
Cc: email@hidden
>
Subject: Re: NSAffineTransform
>
>
Store the path untransformed and store the scaling factors along with
>
it. Dragging the mouse just changes the stored scaling factors so it's
>
fast. Then when you draw the path, apply the transformation. The
>
original path is never changed.
>
>
--Graham
>
>
>
On 24 Oct 2004, at 2:39 am, Lorenzo wrote:
>
>
> Hi there,
>
> suppose that when I drag the mouse I want to resize dinamically a
>
> NSBezierPath. Actually I do that resampling any point of the
>
> bezierPath. And
>
> it works, slowly but it works. Now I have just discovered that I can
>
> use
>
> NSAffineTransform.
>
>
>
> NSAffineTransform *myTransform = [NSAffineTransform transform];
>
> while(mouseDrag){
>
> [myTransform scaleXBy:factorX scaleYBy:factorY];
>
> [bezierPath transformUsingAffineTransform:myTransform];
>
> // ...
>
> }
>
>
>
> but the problem is that once I apply the first scaling to the
>
> bezierPath,
>
> it became transformed thus the next scaling should pay attention to
>
> the new
>
> scale. The final (wrong) effect is that it keeps to resize double than
>
> the
>
> expected value. Do you suggest something in order to fix this problem?
>
> Should I save the original bezierPath then duplicate and tranform the
>
> bezierPath at any loop...?
>
>
>
> Best Regards
>
> --
>
> Lorenzo
>
> email: email@hidden
>
>
>
> _______________________________________________
>
> Do not post admin requests to the list. They will be ignored.
>
> Cocoa-dev mailing list (email@hidden)
>
> Help/Unsubscribe/Update your Subscription:
>
> email@hidden
>
>
>
> This email sent to email@hidden
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden