Hi all,

I'm tying to understand the exact definition of the Cocoa drawing and event 
coordinate system on macOS.  In particular the exact location of 0,0 and 
subpixel accuracy.

I know 0,0 is the bottom-left, but is it:
 - the centre of the bottom-left pixel?
 - the bottom-left corner of the bottom-left pixel?

I made a custom NSView and implemented mouseDown:

- (void)mouseDown:(NSEvent*)inEvent {
        NSPoint viewPoint = [self convertPoint:[inEvent locationInWindow] 

I then use Pixie.app at max magnification and click the bottom-left pixel, 
yielding results like:

(lldb) p viewPoint
(NSPoint) $3 = (x = 0.15234375, y = 0.90625)

So it's giving fractional values, but they are hard to interpret without 
knowing where 0,0 is exactly.

Then there's the 'locationInWindow' docs, that say "Note: The y coordinate in 
the returned point starts from a base of 1, not 0."  That's quite odd.  Why?

Does anyone know the exact details here?


Sean McBride, B. Eng                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada


Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to