From a view rect to a screen rect
From a view rect to a screen rect
- Subject: From a view rect to a screen rect
- From: Development <email@hidden>
- Date: Fri, 01 Jul 2011 11:43:56 -0700
I am sure I am missing something simple but I've tried everything I can find
I need to convert a rectangle in a NSView to a corresponding rectangle in screen coordinates.
originally I was using this code:
selected.origin.x = selection.origin.x / ([imageView frame].size.width/screen.size.width);
selected.origin.y = selection.origin.y / ([imageView frame].size.height/screen.size.height)+25;
selected.size.height = selection.size.height / ([imageView frame].size.height/screen.size.height);
selected.size.width = selection.size.width / ([imageView frame].size.width/screen.size.width);
and it worked. However I have had to change the means by which I was capturing the screen to CGDisplayCreateImageForRect
I want to select an area in a view that represents the entire screen. I need that rectangle then to be translated to the correct size and origin in screen coordinates.
The above code creates a rectangle of the correct size but the origin is so far off I cannot image how to fix it.
I have tried having the view itself use convertRectToBase passing the screen bounds. This creates a rectangle of the correct size but the origin is always, no matter what, 15,183.
I'm totally lost here and don't even know what to search for now that my other attempts have failed.
Could some one help me out?
I'm hoping to find something with low overhead as clicks are a factor._______________________________________________
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