Re: how to convert metric to pixels



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











.



Relevant Pages

  • Re: how to convert metric to pixels
    ... 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. ... to get your physical screen resolution. ...
    (comp.lang.java.help)
  • Re: ARIA TECNOLGY NO GOOD
    ... two mistakes in his short quote from William, ... This was not a few dead pixels, on a 19" LCD most panels use ... I've had 2 previous monitors with bad pixels from Aria, ... What made me annoyed with Aria was the fact that on returning the monitor to ...
    (uk.comp.vendors)
  • Re: Rasterizer differences win98/XP
    ... More precisely, 2*n-1 sampling points, all ... vertically at the pixel's center, horizontally spaced by 1/n pixels, ... This is either a side-effect of your CRT monitor, ... I still suspect that your font was subjected to ...
    (comp.fonts)
  • Re: IIgs RGB to VGA experiment
    ... So you advocate a small monitor only to ... translate 70ns to displayable monitor pixels in 39+ microseconds, ... a display listed as "1080i" would have a pixel resolution of only 1366x768, which is clearly far less than the 1920x1080 that one might ... The second motive is to make sure that high resolution digital video ...
    (comp.sys.apple2)
  • Re: Monitor dimensions
    ... come to think that I maybe accidently bought a 4:3 monitor when I ... happens when I display a 1280 x 960 image which I'd previously ... where did square pixels come from? ... produce more 3:2 images than 4:3 ones, but none of the screens is perfect. ...
    (rec.photo.digital.slr-systems)