On Fri, 2005-08-19 at 13:17 -0500, Earl F. Glynn wrote:
Berton Gunter [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Failing that, (how) can this be done for Windows (XP or 2000, say) ?
Take a look at the Windows GetDeviceCaps API call
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_88s3.asp
Parameters that can be queried include:
HORZRES Width, in pixels, of the screen.
VERTRES Height, in raster lines, of the screen.
HORZSIZE Width, in millimeters, of the physical screen
VERTSIZE Height, in millimeters, of the physical screen
The specifics of how to use this API call will vary by language. Google
will be your friend.
FWIW, in case anyone should see this thread and wonder how to do this
somewhat easily in R for systems running X, there is a CLI utility
called 'xdpyinfo' that returns a great deal of data on the connected
display(s).
display.size - system(xdpyinfo | grep dimensions, intern = TRUE)
display.dpi - system(xdpyinfo | grep resolution, intern = TRUE)
display.size
[1] dimensions:1600x1200 pixels (301x231 millimeters)
display.dpi
[1] resolution:135x132 dots per inch
One can then parse the above using R functions as required. Such as:
d.size - unlist(strsplit(display.size, split = [[:space:]|(|)|x]))
d.size
[1] dimensions:
[5] 16001200
[9] pi els 301
[13] 231 millimeters
h.pix - as.numeric(d.size[7])
v.pix - as.numeric(d.size[8])
h.mm - as.numeric(d.size[12])
v.mm - as.numeric(d.size[13])
line1 - sprintf(The current display is %d x %d pixels,
h.pix, v.pix)
line2 - sprintf(with a physical size of %d x %d mm, h.mm, v.mm)
cat(line1, line2, sep = \n)
The current display is 1600 x 1200 pixels
with a physical size of 301 x 231 mm
This can get more complicated with multi-monitor systems, depending upon
whether you are running in xinerama (multi-monitor spanning mode) or
non-xinerama mode and consideration for symmetric or asymmetric
resolutions. 'man xdpyinfo' and 'man X' (noting the 'DISPLAY'
environment variable) will be helpful here to determine which
display/screen R is running on.
For example, on my system which has two displays, each with 1600x1200, I
get:
Sys.getenv(DISPLAY)
DISPLAY
:0.0
with R running on the main laptop LCD (15 diag), versus:
Sys.getenv(DISPLAY)
DISPLAY
:0.1
with R running on the external LCD (20.1 diag), with the DISPLAY
variable indicating:
:DisplayNumber.ScreenNumber
Thus, on my system, the output of the system() calls are actually:
display.size - system(xdpyinfo | grep dimensions, intern = TRUE)
display.dpi - system(xdpyinfo | grep resolution, intern = TRUE)
display.size
[1] dimensions:1600x1200 pixels (301x231 millimeters)
[2] dimensions:1600x1200 pixels (411x311 millimeters)
display.dpi
[1] resolution:135x132 dots per inch
[2] resolution:99x98 dots per inch
HTH,
Marc Schwartz
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html