Re: after resizing an image...
Re: after resizing an image...
- Subject: Re: after resizing an image...
- From: Daniel Staal <email@hidden>
- Date: Thu, 18 Oct 2007 08:31:36 -0400
--As of October 17, 2007 8:02:10 PM -0700, Development is alleged to have
said:
Now I thought my math was right to reset the selected area so that when
the cropping took place the right area was selected however my math is
WAY off as I get completely unpredictable results. This is the formula I
was using :
float factor = originalSize.width / currentSize.size.width;
then to reset the selection:
selection.size.width /=factor;
selection.size.height /=factor;
selection.origin.x /=factor;
selection.origin.y /=factor;
--As for the rest, it is mine.
Width and height are total size, but origin isn't. You'll need two scaling
factors here, one for the size of the selection and one for it's placement.
(If the origin actually moves at all.)
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden