Top Description Fields Constructors Methods
com.jogamp.newt

public abstract Class MonitorDevice

extends Object
Class Inheritance
Known Direct Subclasses
jogamp.newt.MonitorDeviceImpl
Imports
java.util.List, com.jogamp.nativewindow.ScalableSurface, com.jogamp.nativewindow.util.DimensionImmutable, .Rectangle, .RectangleImmutable, .SurfaceSize, com.jogamp.common.util.ArrayHashSet

Visual output device, i.e. a CRT, LED ..consisting of it's components:
  • Immutable
  • Mutable
  • All values of this interface are represented in pixel units, if not stated otherwise.

    Field Summary

    Modifier and TypeField and Description
    protected MonitorMode
    protected boolean
    protected boolean
    protected boolean
    protected final int
    protected final MonitorMode
    protected final float[]
    protected final Screen
    protected final DimensionImmutable
    protected final ArrayHashSet<MonitorMode>
    protected final Rectangle
    protected final Rectangle

    Constructor Summary

    AccessConstructor and Description
    protected
    MonitorDevice(final Screen
    associated Screen
    screen
    ,
    final int
    unique monitor device ID
    nativeId
    ,
    final boolean
    flag
    isClone
    ,
    final boolean
    flag
    isPrimary
    ,
    final DimensionImmutable
    size in millimeters
    sizeMM
    ,
    final MonitorMode currentMode, final float[]
    pre-fetched current pixel-scale, maybe null for ScalableSurface#IDENTITY_PIXELSCALE.
    pixelScale
    ,
    final Rectangle
    viewport in pixel-units
    viewportPU
    ,
    final Rectangle
    viewport in window-units
    viewportWU
    ,
    final ArrayHashSet<MonitorMode>
    all supported MonitorModes
    supportedModes
    )

    Method Summary

    Modifier and TypeMethod and Description
    public final boolean
    contains(final int
    x-coord in pixel units
    x
    ,
    final int
    y-coord in pixel units
    y
    )

    Returns true if given screen coordinates in pixel units are contained by this viewport, otherwise false.

    public final boolean
    equals(final Object
    the reference object with which to compare.
    obj
    )

    Overrides java.lang.Object.equals.

    Tests equality of two MonitorDevice objects by evaluating equality of it's components:
    • nativeID
    public final MonitorMode
    getCurrentMode()

    Returns the cached current MonitorMode w/o native query.

    public final int

    Returns:

    the immutable unique native Id of this monitor device.
    getId
    ()

    public final MonitorMode
    getOriginalMode()

    Returns the immutable original com.jogamp.newt.MonitorMode, as used at NEWT initialization.

    public float[]
    getPixelScale(final float[] result)

    Returns the current rotated pixel-scale of this monitor, i.e. horizontal and vertical.

    public final float[]

    Returns:

    the passed storage containing the ppmm for chaining
    getPixelsPerMM
    (final float[]
    float[2] storage for the ppmm result
    ppmmStore
    )

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

    public final float[]

    Returns:

    the passed storage containing the ppmm for chaining
    getPixelsPerMM
    (final MonitorMode mode, final float[]
    float[2] storage for the ppmm result
    ppmmStore
    )

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

    public final Screen
    getScreen()

    Returns the Screen owning this monitor.

    public final DimensionImmutable

    Returns:

    the immutable monitor size in millimeters.
    getSizeMM
    ()

    public final List<MonitorMode>
    getSupportedModes()

    Returns a list of immutable MonitorModes supported by this monitor.

    public final RectangleImmutable
    getViewport()

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

    public final RectangleImmutable
    getViewportInWindowUnits()

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

    public final int
    hashCode()

    Overrides java.lang.Object.hashCode.

    Returns a combined hash code of it's elements:
    • nativeID
    public final boolean

    Returns:

    true if this device represents a clone, otherwise return false.
    isClone
    ()

    public final boolean
    isModeChangedByUs()

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

    public final boolean
    public final boolean
    isPrimary()

    Returns true if this device represents the primary device, otherwise return false.

    public abstract MonitorMode
    queryCurrentMode()

    Returns the current MonitorMode resulting from a native query.

    public abstract boolean

    Returns:

    true if successful, otherwise false
    setCurrentMode
    (MonitorMode
    to be made current, must be element of the list getSupportedModes() and Screen#getMonitorModes().
    mode
    )

    Set the current com.jogamp.newt.MonitorMode.

    public String
    toString()

    Overrides java.lang.Object.toString.

    Returns a string representation of the object.
    public static void
    unionOfViewports(final Rectangle
    storage for result in pixel units, maybe null
    viewport
    ,
    final Rectangle
    storage for result in window units, maybe null
    viewportInWindowUnits
    ,
    final List<MonitorDevice>
    given list of monitors
    monitors
    )

    Calculates the union of the given monitor's viewport in pixel- and window units.

    Inherited from java.lang.Object:
    clonefinalizegetClassnotifynotifyAllwaitwaitwait

    Field Detail

    currentModeback to summary
    protected MonitorMode currentMode
    isCloneback to summary
    protected boolean isClone
    isPrimaryback to summary
    protected boolean isPrimary
    modeChangedback to summary
    protected boolean modeChanged
    nativeIdback to summary
    protected final int nativeId
    originalModeback to summary
    protected final MonitorMode originalMode
    pixelScaleback to summary
    protected final float[] pixelScale
    screenback to summary
    protected final Screen screen
    sizeMMback to summary
    protected final DimensionImmutable sizeMM
    supportedModesback to summary
    protected final ArrayHashSet<MonitorMode> supportedModes
    viewportPUback to summary
    protected final Rectangle viewportPU
    viewportWUback to summary
    protected final Rectangle viewportWU

    Constructor Detail

    MonitorDeviceback to summary
    protected MonitorDevice(final Screen screen, final int nativeId, final boolean isClone, final boolean isPrimary, final DimensionImmutable sizeMM, final MonitorMode currentMode, final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU, final ArrayHashSet<MonitorMode> supportedModes)
    Parameters
    screen:Screen

    associated Screen

    nativeId:int

    unique monitor device ID

    isClone:boolean

    flag

    isPrimary:boolean

    flag

    sizeMM:DimensionImmutable

    size in millimeters

    pixelScale:float[]

    pre-fetched current pixel-scale, maybe null for ScalableSurface#IDENTITY_PIXELSCALE.

    viewportPU:Rectangle

    viewport in pixel-units

    viewportWU:Rectangle

    viewport in window-units

    supportedModes:ArrayHashSet<MonitorMode>

    all supported MonitorModes

    Method Detail

    containsback to summary
    public final boolean contains(final int x, final int y)

    Returns true if given screen coordinates in pixel units are contained by this viewport, otherwise false.

    Parameters
    x:int

    x-coord in pixel units

    y:int

    y-coord in pixel units

    equalsback to summary
    public final boolean equals(final Object obj)

    Overrides java.lang.Object.equals.

    Tests equality of two MonitorDevice objects by evaluating equality of it's components:

    • nativeID

    Parameters
    obj:Object

    Doc from java.lang.Object.equals.

    the reference object with which to compare.

    Returns:boolean

    Doc from java.lang.Object.equals.

    true if this object is the same as the obj argument; false otherwise.

    Annotations
    @Override
    getCurrentModeback to summary
    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()
    getIdback to summary
    public final int getId()
    Returns:int

    the immutable unique native Id of this monitor device.

    getOriginalModeback to summary
    public final MonitorMode getOriginalMode()

    Returns the immutable original com.jogamp.newt.MonitorMode, as used at NEWT initialization.

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

    getPixelScaleback to summary
    public float[] getPixelScale(final float[] result)

    Returns the current rotated pixel-scale of this monitor, i.e. horizontal and vertical.

    See Also
    getViewportInWindowUnits(), getViewport(), ScalableSurface#getMaximumSurfaceScale(float[])
    getPixelsPerMMback to summary
    public final float[] getPixelsPerMM(final 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[]

    float[2] storage for the ppmm result

    Returns:float[]

    the passed storage containing the ppmm for chaining

    getPixelsPerMMback to summary
    public final float[] getPixelsPerMM(final MonitorMode mode, final 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
    ppmmStore:float[]

    float[2] storage for the ppmm result

    Returns:float[]

    the passed storage containing the ppmm for chaining

    getScreenback to summary
    public final Screen getScreen()

    Returns the Screen owning this monitor.

    getSizeMMback to summary
    public final DimensionImmutable getSizeMM()
    Returns:DimensionImmutable

    the immutable monitor size in millimeters.

    getSupportedModesback to summary
    public final List<MonitorMode> getSupportedModes()

    Returns a list of immutable MonitorModes supported by this monitor.

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

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

    getViewportback to summary
    public final RectangleImmutable getViewport()

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

    See Also
    getPixelScale(), Screen#getViewport()
    getViewportInWindowUnitsback to summary
    public final RectangleImmutable getViewportInWindowUnits()

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

    See Also
    getPixelScale(), Screen#getViewportInWindowUnits()
    hashCodeback to summary
    public final int hashCode()

    Overrides java.lang.Object.hashCode.

    Returns a combined hash code of it's elements:

    • nativeID
    Returns:int

    Doc from java.lang.Object.hashCode.

    a hash code value for this object

    Annotations
    @Override
    isCloneback to summary
    public final boolean isClone()
    Returns:boolean

    true if this device represents a clone, otherwise return false.

    isModeChangedByUsback to summary
    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.

    isOriginalModeback to summary
    public final boolean isOriginalMode()
    isPrimaryback to summary
    public final boolean isPrimary()

    Returns true if this device represents the primary device, otherwise return false.

    See Also
    Screen#getPrimaryMonitor()
    queryCurrentModeback to summary
    public abstract MonitorMode queryCurrentMode() throws IllegalStateException

    Returns the current MonitorMode resulting from a native query.

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

    Exceptions
    IllegalStateException:
    if the associated screen is not valid natively.
    See Also
    getCurrentMode()
    setCurrentModeback to summary
    public abstract boolean setCurrentMode(MonitorMode mode) throws IllegalStateException

    Set the current com.jogamp.newt.MonitorMode.

    This method is lifecycle heavy.

    Parameters
    mode:MonitorMode

    to be made current, must be element of the list getSupportedModes() and Screen#getMonitorModes().

    Returns:boolean

    true if successful, otherwise false

    Exceptions
    IllegalStateException:
    if the associated screen is not valid natively.
    toStringback to summary
    public String toString()

    Overrides java.lang.Object.toString.

    Doc from java.lang.Object.toString.

    Returns a string representation of the object.

    Returns:String

    a string representation of the object

    Annotations
    @Override
    unionOfViewportsback to summary
    public static void unionOfViewports(final Rectangle viewport, final Rectangle viewportInWindowUnits, final List<MonitorDevice> monitors)

    Calculates the union of the given monitor's viewport in pixel- and window units.

    Parameters
    viewport:Rectangle

    storage for result in pixel units, maybe null

    viewportInWindowUnits:Rectangle

    storage for result in window units, maybe null

    monitors:List<MonitorDevice>

    given list of monitors