• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Coordinates of Pixels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Coordinates of Pixels (From: Richard Somers <email@hidden>)
 >Re: Coordinates of Pixels (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: Tracking Rectangle Bounds
  • Next by Date: Re: Tracking Rectangle Bounds
  • Previous by thread: Re: Coordinates of Pixels
  • Next by thread: KVC To-Many and BOOL
  • Index(es):
    • Date
    • Thread