Re: how to convert metric to pixels
- From: tar@xxxxxxxxxxxxx (Thomas A. Russ)
- Date: 26 Oct 2007 14:37:27 -0700
Rita Leon <dingo@xxxxxxxxxxx> writes:
On Fri, 26 Oct 2007 09:50:44 GMT, Thomas Fritsch
<i.dont.like.spam@xxxxxxxxxxx> wrote:
You idea is possible but the number of pixels per unit will vary
depending on the physical size of the monitor and the size of a pixel.
Yes, and if you had read the documentation that comes with
getScreenResolution, you would have seen that the value that is returned
is the number of pixels per inch. So the routine is already supposed to
have taken that into consideration.
Note that getScreenSize returns the dimensions in pixels, which is
different.
A 17" monitor @ 1024x768 will have a different number of pixels per
unit than a 22" monitor @ 1024x768. And then there is the issue of
dot pitch...
ty for the suggestion.
You can call
int resolution = Toolkit.getDefaultToolkit().getScreenResolution();
to get your physical screen resolution (on my screen I get 96). Having
that number, it is simple arithmetics to convert inches to pixels and
vice versa.
See
<http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Toolkit.html#getScreenResolution()>
--
Thomas A. Russ, USC/Information Sciences Institute
.
- References:
- how to convert metric to pixels
- From: Rita Leon
- Re: how to convert metric to pixels
- From: Thomas Fritsch
- Re: how to convert metric to pixels
- From: Rita Leon
- how to convert metric to pixels
- Prev by Date: Re: Calling a C function from Java using the JNI
- Next by Date: Re: how to convert metric to pixels
- Previous by thread: Re: how to convert metric to pixels
- Next by thread: Re: how to convert metric to pixels
- Index(es):
Relevant Pages
|
|