Re: Drawing scaled lines
Re: Drawing scaled lines
- Subject: Re: Drawing scaled lines
- From: Andrew Zamler-Carhart <email@hidden>
- Date: Fri, 7 Jan 2005 20:42:59 +0000
Hi folks,
I did a little trigonometry and calculated the actual pixel densities
of Apple's current flat panel lineup:
12" iBook G4 -- 105.79 dpi
14" iBook G4 -- 90.78 dpi
12" PowerBook G4 -- 105.79 dpi
15" PowerBook G4 -- 101.23 dpi
17" PowerBook G4 -- 101.21 dpi
17" iMac G5 -- 101.21 dpi
20" iMac G5 -- 99.75 dpi
20" Cinema Display -- 99.75 dpi
23" Cinema Display -- 97.71 dpi
30" Cinema Display -- 101.65 dpi
As John pointed out, most of the current displays are about 100±2 dpi,
except for the 12" laptops which have a much higher dpi. Some older
products have a much lower dpi:
12" iBook -- 82.64 dpi
14" PowerBook G3 -- 90.78
22" Cinema Display -- 86.35 dpi
So if you want to assume that the user has a current Apple flat-panel
display, bigger than 12", running at its native resolution, then 100±2
dpi is a safe bet. I'll leave it up to you whether it's safe to make
all those assumptions.
If you want to be precise about it, rather than having the user fetch a
ruler, you could offer a popup menu and ask which display they have,
and adjust your drawing accordingly. Resolutions and sizes are all
available on www.apple.com, and you can use the following formula to
get the dpi.
dpi = pixelsWide / (inches * cos(atan(pixelsHigh / pixelsWide)));
This is why NSSize uses doubles. ;-)
Best regards,
Andrew
KavaSoft
On Jan 7, 2005, at 7:52 PM, John Stiles wrote:
There is no way to figure out the actual physical size of a monitor
programatically. And every monitor is going to be a little bit
different. Apple's current flat-panel lineup is all *about* 100dpi,
but each model is slightly off. I don't remember the exact numbers.
Third-party monitors—particularly CRTs—will vary wildly and of course
it will also depend on resolution chosen by the end user. I would let
the user configure this. Render a line on the screen, ask them to
measure it and tell you how long it is, and then you can work
backwards to figure out the exact DPI of the screen. I'd default to
100 until otherwise configured, so you'll be "pretty close" on an
Apple flat-panel right out of the box.
On Jan 7, 2005, at 11:41 AM, Mark Dawson wrote:
I want to draw line figures (lines, rects, etc) that are correctly
scaled (i.e., 1" on screen is 1' in real life). I haven't quite
figured out the question to ask to find the correct documentation…
I've found that NSSize is the basic size, which contains floats.
From what I can tell, they are in "point" units. Do I just use the
72.0 points/inch constant, or is there a system call that I should
use? Give than NSize uses floats, what does it mean to have 1.01
points--i.e., do fractional points show up?
Thanks,
mark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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
_______________________________________________
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