Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6522214

java.awt.DisplayMode should support getDpi()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 6
    • client-libs
    • 2d
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      In order to be able to realtistcally display certin type of graphics, it is important to know the DPI of a screen. Screens, and other device, these days are no-longer limited to 72 DPI. Currently there is now way to find the actual resolution of a screen, or any drawing routine that would allow the use of 'real world' units.

      Since 'java.awt.DisplayMode' provide operations to find most other details on a device, I would expect to also include a method to describe the DPI.

      Affects all platforms.


      JUSTIFICATION :
      One example situation is if I want to draw a line that is 5cm long. If I assume 72 DPI, then the line will be much shorter than 5cm if I hold up a ruler to the screen. This is is useful for graphics programs which are trying to provide the user a WYSIWYG display.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      see description & justification.
      ACTUAL -
      If I use Toolkit.getScreenResolution() I get 72 DPI all the time and this is not even an averaging of the resolutions of the screens available.

      CUSTOMER SUBMITTED WORKAROUND :
      Possibly using JNI to access native device information. I have not yet identified whether the information provided by 'java.awt.GraphicsDevice' would allow me to identify the appropriate device in native code.

            tdv Dmitri Trembovetski (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: