• 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: Converting HIPoints to CGPoints/NSPoints in global space?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting HIPoints to CGPoints/NSPoints in global space?


  • Subject: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • From: Raleigh Ledet <email@hidden>
  • Date: Mon, 13 Feb 2006 10:00:51 -0800

HiPoints are not always 0,0 upper left. HIViews mimic NSViews See:
<http://developer.apple.com/documentation/Carbon/Conceptual/HIViewDoc/ HIView_concept/chapter_1_section_1.html>


However, this is not always the case. Global carbon HIPoint mouse coordinates are origin upper left. You must know the source of the HIPoint to make any judgement on it.

Why are you looping through all the displays? The only one that matters is the one with the menu bar. If you want to go from Carbon global space to Cocoa global space, the the bottom left of the screen with the menu bar is your origin. Use that screen's height in your calculation.

-raleigh

On Feb 12, 2006, at 2:18 PM, email@hidden wrote:

Sorry...

HIPoints in general are relative to 0,0 in the upper left.
NSPoints (and CGPoints) are relative to 0,0 in the lower left.

so an HIPoint at x,y coordinates is equivalent to an NSPoint at
x,displaysheight - y

The question is an easy way of figuring out exactly how high the
display height is, especially in the case of multiple monitors.

Currently I'm looping through the displays, but there's got to be a
better way of doing it.

Cheers,
Dave

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Converting HIPoints to CGPoints/NSPoints in global space?
      • From: Dave MacLachlan <email@hidden>
    • Re: Converting HIPoints to CGPoints/NSPoints in global space?
      • From: Scott Thompson <email@hidden>
  • Prev by Date: Re: Affine Transform
  • Next by Date: Processing TIFF/PNG Layers
  • Previous by thread: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • Next by thread: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • Index(es):
    • Date
    • Thread