• 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: Drawing scaled lines
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing scaled lines


  • Subject: Re: Drawing scaled lines
  • From: Robert Clair <email@hidden>
  • Date: Fri, 7 Jan 2005 15:17:18 -0500

The default quartz coordinate system is PostScript points (1/72 of an inch) and it
makes the assumption that displays are 72 dpi. Convenient, but not reflective
of the real world. You have to scale the view bounds (see NSView scaleUnitSquareToSize: or
NSView setBounds:) so that the ratio of the bounds width to the frame width of the view
is (display dpi)/72.0.


Unfortunately there is no way to determine the display dpi programatically, even in the case of
a laptop where the display is hardwired. There is some sample code floating around that claims to
do it, but it uselessly returns 72 in all cases. You have to ask the user to enter it (probably as a
preference).


A 15" TIBook is 101.4 dpi. (I have NO idea, it doesn't come out even in metric either.)

Good luck,

Bob Clair

_______________________________________________
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: Drawing scaled lines (whoops)
      • From: Robert Clair <email@hidden>
  • Prev by Date: Re: Drawing scaled lines
  • Next by Date: Re: image drawing glitch
  • Previous by thread: Re: Drawing scaled lines
  • Next by thread: Re: Drawing scaled lines (whoops)
  • Index(es):
    • Date
    • Thread