Re: Coordinates of Pixels
Re: Coordinates of Pixels
- Subject: Re: Coordinates of Pixels
- From: Richard Somers <email@hidden>
- Date: Wed, 18 Jul 2007 16:23:17 -0600
I guess I need more help or further clarification.
I have a custom view with a tracking rectangle over the entire
bounds. When the mouse enters the tracking rectangle the mouse point
from the event is converted to the view space and output to the log.
- (void)mouseEntered:(NSEvent *)event
{
...
NSPoint location = [event locationInWindow];
mousePoint = [self convertPoint:location fromView:nil];
NSLog(@"mousePoint x = %f, y = %f", mousePoint.x, mousePoint.y);
...
}
When the mouse enters the tracking rectangle by touching the lower
left pixel of the view the output from the log is
... mousePoint x = 0.000000, y = 0.000000
So it would appear that -
When reading a pixel the coordinates indicated are those of the lower
left corner of the pixel.
When writing a pixel the "sweet spot" coordinate location is half way
in between as the previous poster has noted.
So there is always a 0.5 difference in location between reading and
writing the exact same pixel. Is this correct?
Regards, Richard
_______________________________________________
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