com.jogamp.newt

## Class MonitorDevice

- java.lang.Object
- - com.jogamp.newt.MonitorDevice

-     public abstract class MonitorDevice
      extends Object

  Visual output device, i.e. a CRT, LED ..consisting of it's components:
- Immutable
  - nativeId
  - `DimensionImmutable` size in [mm]
  - `MonitorMode` original mode
  - `List<MonitorMode>` supportedModes
- Mutable
  - `MonitorMode` current mode
  - `RectangleImmutable` viewport (rotated)

All values of this interface are represented in pixel units, if not stated otherwise.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(int x, int y)` Returns `true` if given screen coordinates in pixel units are contained by this `viewport`, otherwise `false`.
    `boolean` | `equals(Object obj)` Tests equality of two `MonitorDevice` objects by evaluating equality of it's components: `nativeID`
    `MonitorMode` | `getCurrentMode()` Returns the cached current `MonitorMode` w/o native query.
    `int` | `getId()`
    `MonitorMode` | `getOriginalMode()` Returns the immutable original `MonitorMode`, as used at NEWT initialization.
    `float[]` | `getPixelsPerMM(float[] ppmmStore)` Returns the pixels per millimeter value according to the current `mode`'s `surface resolution`.
    `float[]` | `getPixelsPerMM(MonitorMode mode, float[] ppmmStore)` Returns the pixels per millimeter value according to the given `mode`'s `surface resolution`.
    `Screen` | `getScreen()` Returns the `Screen` owning this monitor.
    `DimensionImmutable` | `getSizeMM()`
    `List<MonitorMode>` | `getSupportedModes()` Returns a list of immutable `MonitorMode`s supported by this monitor.
    `RectangleImmutable` | `getViewport()` Returns the `rectangular` portion of the rotated virtual `Screen` size in pixel units represented by this monitor, i.e.
    `RectangleImmutable` | `getViewportInWindowUnits()` Returns the `rectangular` portion of the rotated virtual `Screen` size in window units represented by this monitor, i.e.
    `int` | `hashCode()` Returns a combined hash code of it's elements: `nativeID`
    `boolean` | `isModeChangedByUs()` Returns `true if the `MonitorMode` has been changed programmatic via this API only, otherwise `false`.`
    `boolean` | `isOriginalMode()`
    `abstract MonitorMode` | `queryCurrentMode()` Returns the current `MonitorMode` resulting from a native query.
    `abstract boolean` | `setCurrentMode(MonitorMode mode)` Set the current `MonitorMode`.
    `String` | `toString()`
    `static void` | `unionOfViewports(Rectangle viewport, Rectangle viewportInWindowUnits, List<MonitorDevice> monitors)` Calculates the union of the given monitor's `viewport` in pixel- and window units.

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getScreen

          public final Screen getScreen()

      Returns the `Screen` owning this monitor.

    - #### equals

          public final boolean equals(Object obj)

      Tests equality of two `MonitorDevice` objects by evaluating equality of it's components:
      - `nativeID`
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public final int hashCode()

      Returns a combined hash code of it's elements:
      - `nativeID`
      Overrides:
        `hashCode` in class `Object`

    - #### getId

          public final int getId()

      Returns:
        the immutable unique native Id of this monitor device.

    - #### getSizeMM

          public final DimensionImmutable getSizeMM()

      Returns:
        the immutable monitor size in millimeters.

    - #### getPixelsPerMM

          public final float[] getPixelsPerMM(float[] ppmmStore)

      Returns the pixels per millimeter value according to the current `mode`'s `surface resolution`.

      To convert the result to dpi, i.e. dots-per-inch, multiply both components with `25.4f`.

      Parameters:
        `ppmmStore` - float[2] storage for the ppmm result
      Returns:
        the passed storage containing the ppmm for chaining

    - #### getPixelsPerMM

          public final float[] getPixelsPerMM(MonitorMode mode,
                               float[] ppmmStore)

      Returns the pixels per millimeter value according to the given `mode`'s `surface resolution`.

      To convert the result to dpi, i.e. dots-per-inch, multiply both components with `25.4f`.

      Parameters:
        `mode` -
        `ppmmStore` - float[2] storage for the ppmm result
      Returns:
        the passed storage containing the ppmm for chaining

    - #### getOriginalMode

          public final MonitorMode getOriginalMode()

      Returns the immutable original `MonitorMode`, as used at NEWT initialization.

      The returned `MonitorMode` is element of the lists `getSupportedModes()` and `Screen.getMonitorModes()`.

    - #### getSupportedModes

          public final List<MonitorMode> getSupportedModes()

      Returns a list of immutable `MonitorMode`s supported by this monitor.

      The list is ordered in descending order, see `MonitorMode.compareTo(MonitorMode)`.

      Use w/ care, it's not a copy!

    - #### getViewport

          public final RectangleImmutable getViewport()

      Returns the `rectangular` portion of the rotated virtual `Screen` size in pixel units represented by this monitor, i.e. top-left origin and size.
      See Also:
        `Screen`

    - #### getViewportInWindowUnits

          public final RectangleImmutable getViewportInWindowUnits()

      Returns the `rectangular` portion of the rotated virtual `Screen` size in window units represented by this monitor, i.e. top-left origin and size.
      See Also:
        `Screen`

    - #### contains

          public final boolean contains(int x,
                         int y)

      Returns `true` if given screen coordinates in pixel units are contained by this `viewport`, otherwise `false`.
      Parameters:
        `x` - x-coord in pixel units
        `y` - y-coord in pixel units

    - #### unionOfViewports

          public static void unionOfViewports(Rectangle viewport,
                              Rectangle viewportInWindowUnits,
                              List<MonitorDevice> monitors)

      Calculates the union of the given monitor's `viewport` in pixel- and window units.
      Parameters:
        `viewport` - storage for result in pixel units, maybe null
        `viewportInWindowUnits` - storage for result in window units, maybe null
        `monitors` - given list of monitors

    - #### isOriginalMode

          public final boolean isOriginalMode()

    - #### isModeChangedByUs

          public final boolean isModeChangedByUs()

      Returns `true if the `MonitorMode` has been changed programmatic via this API only, otherwise `false`.

      Note: We cannot guarantee that we won't interfere w/ another running application's screen mode change or vice versa.

      `

    - #### getCurrentMode

          public final MonitorMode getCurrentMode()

      Returns the cached current `MonitorMode` w/o native query.

      The returned `MonitorMode` is element of the lists `getSupportedModes()` and `Screen.getMonitorModes()`.

      See Also:
        `queryCurrentMode()`

    - #### queryCurrentMode

          public abstract MonitorMode queryCurrentMode()

      Returns the current `MonitorMode` resulting from a native query.

      The returned `MonitorMode` is element of the lists `getSupportedModes()` and `Screen.getMonitorModes()`.

      See Also:
        `getCurrentMode()`

    - #### setCurrentMode

          public abstract boolean setCurrentMode(MonitorMode mode)

      Set the current `MonitorMode`.
      Parameters:
        `mode` - to be made current, must be element of the list `getSupportedModes()` and `Screen.getMonitorModes()`.
      Returns:
        true if successful, otherwise false

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright 2010 JogAmp Community.