JOGL v2.6.0
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.newt.MonitorDevice Class Referenceabstract

Visual output device, i.e. More...

Collaboration diagram for com.jogamp.newt.MonitorDevice:

Classes

enum  Orientation
 

Public Member Functions

final Orientation getOrientationTo (final MonitorDevice other, final int move_diff[])
 Returns the orientation of this monitor to the other. More...
 
final Screen getScreen ()
 Returns the Screen owning this monitor. More...
 
final boolean equals (final Object obj)
 Tests equality of two MonitorDevice objects by evaluating equality of it's components:
More...
 
final int hashCode ()
 Returns a combined hash code of it's elements:
More...
 
final long getHandle ()
 
final int getId ()
 
final String getName ()
 
final boolean isClone ()
 
final boolean isPrimary ()
 Returns true if this device represents the primary device, otherwise return false. More...
 
final DimensionImmutable getSizeMM ()
 
final float[] getPixelsPerMM (final float[] ppmmStore)
 Returns the pixels per millimeter value according to the current mode's surface resolution. More...
 
final float[] getPixelsPerMM (final MonitorMode mode, final float[] ppmmStore)
 Returns the pixels per millimeter value according to the given mode's surface resolution. More...
 
final MonitorMode getOriginalMode ()
 Returns the immutable original com.jogamp.newt.MonitorMode, as used at NEWT initialization. More...
 
final List< MonitorModegetSupportedModes ()
 Returns a list of immutable MonitorModes supported by this monitor. More...
 
final RectangleImmutable getViewport ()
 Returns the current rectangular portion of the rotated virtual Screen size in pixel units represented by this monitor, i.e. More...
 
final RectangleImmutable getViewportInWindowUnits ()
 Returns the current rectangular portion of the rotated virtual Screen size in window units represented by this monitor, i.e. More...
 
float[] getPixelScale (final float[] result)
 Returns the current rotated pixel-scale of this monitor, i.e. More...
 
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. More...
 
final boolean isOriginalMode ()
 
final boolean isModeChangedByUs ()
 Returns true</true> if the MonitorMode has been changed programmatic via this API only, otherwise false. More...
 
final MonitorMode getCurrentMode ()
 Returns the cached current MonitorMode w/o native query. More...
 
abstract MonitorMode queryCurrentMode () throws IllegalStateException
 Returns the current MonitorMode resulting from a native query. More...
 
abstract boolean setCurrentMode (MonitorMode mode) throws IllegalStateException
 Set the current com.jogamp.newt.MonitorMode. More...
 
String toString ()
 

Static Public Member Functions

static float[] mmToInch (final float[] result, final float[] ppmm)
 Converts [1/mm] to [1/inch] from ppmm into result. More...
 
static float[] mmToInch (final float[] ppmm)
 Converts [1/mm] to [1/inch] in place. More...
 
static float mmToInch (final float ppmm)
 Converts [1/mm] to [1/inch]. More...
 
static float[] inchToMM (final float[] result, final float[] ppinch)
 Converts [1/inch] to [1/mm] in place. More...
 
static float[] inchToMM (final float[] ppinch)
 Converts [1/inch] to [1/mm] in place. More...
 
static float inchToMM (final float ppinch)
 Converts [1/inch] to [1/mm]. More...
 
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. More...
 

Static Public Attributes

static final DimensionImmutable DEFAULT_MODE_PIXEL_SIZE
 Pixel size of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62. More...
 
static final boolean DEFAULT_MODE_PIXEL_SIZE_OVERRIDE
 True if DEFAULT_MODE_PIXEL_SIZE is set by properties. More...
 
static final int DEFAULT_MODE_REFRESH
 Refresh rate of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62. More...
 
static final boolean DEFAULT_MODE_REFRESH_OVERRIDE
 True if DEFAULT_MODE_REFRESH is set by properties. More...
 
static final int DEFAULT_MODE_BPP
 Bits per pixel of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62. More...
 
static final boolean DEFAULT_MODE_BPP_OVERRIDE
 True if DEFAULT_MODE_BPP is set by properties. More...
 
static final DimensionImmutable DEFAULT_SCREEN_MM_SIZE
 Display size in millimeter of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62. More...
 
static final boolean DEFAULT_SCREEN_MM_SIZE_OVERRIDE
 True if DEFAULT_SCREEN_MM_SIZE_OVERRIDE is set by properties. More...
 

Protected Member Functions

 MonitorDevice (final Screen screen, final long nativeHandle, final int nativeId, final String name, 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)
 

Protected Attributes

final Screen screen
 
final long nativeHandle
 
final int nativeId
 
final String name
 
final DimensionImmutable sizeMM
 
final MonitorMode originalMode
 
final ArrayHashSet< MonitorModesupportedModes
 
final float[] pixelScale
 
final Rectangle viewportPU
 
final Rectangle viewportWU
 
boolean isClone
 
boolean isPrimary
 
MonitorMode currentMode
 
boolean modeChanged
 

Detailed Description

Visual output device, i.e.

a CRT, LED ..consisting of it's components:
<ui> Immutable

Mutable

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

Default monitor properties: 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62

  • Pixel size of via property newt.monitor.pxwidth and newt.monitor.pxheight
  • Refresh rate via property newt.monitor.refresh
  • Bits per pixel via property newt.monitor.bpp
  • Display size in millimeter via property newt.monitor.mmwidth

The defaults are being used either if value could not be retrieved by the driver or if they are overridden via properties.

Definition at line 72 of file MonitorDevice.java.

Constructor & Destructor Documentation

◆ MonitorDevice()

com.jogamp.newt.MonitorDevice.MonitorDevice ( final Screen  screen,
final long  nativeHandle,
final int  nativeId,
final String  name,
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 
)
protected
Parameters
screenassociated Screen
nativeHandleunique monitor device long handle, implementation specific
nativeIdunique monitor device integer Id, implementation specific
nameoptional monitor name, maybe null
isCloneflag
isPrimaryflag
sizeMMsize in millimeters
currentMode
pixelScalepre-fetched current pixel-scale, maybe null for ScalableSurface#IDENTITY_PIXELSCALE.
viewportPUviewport in pixel-units
viewportWUviewport in window-units
supportedModesall supported MonitorModes

Definition at line 214 of file MonitorDevice.java.

Here is the caller graph for this function:

Member Function Documentation

◆ contains()

final boolean com.jogamp.newt.MonitorDevice.contains ( final int  x,
final int  y 
)

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

Parameters
xx-coord in pixel units
yy-coord in pixel units

Definition at line 453 of file MonitorDevice.java.

Here is the call graph for this function:

◆ equals()

final boolean com.jogamp.newt.MonitorDevice.equals ( final Object  obj)

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

  • nativeID


Definition at line 253 of file MonitorDevice.java.

Here is the call graph for this function:

◆ getCurrentMode()

final MonitorMode com.jogamp.newt.MonitorDevice.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()

Definition at line 518 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getHandle()

final long com.jogamp.newt.MonitorDevice.getHandle ( )
Returns
the immutable unique native long handle of this monitor device, implementation specific.

Definition at line 274 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getId()

final int com.jogamp.newt.MonitorDevice.getId ( )
Returns
the immutable unique native integer Id of this monitor device, implementation specific.

Definition at line 277 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getName()

final String com.jogamp.newt.MonitorDevice.getName ( )
Returns
optional monitor name, maybe an empty string but never null.

Definition at line 280 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getOrientationTo()

final Orientation com.jogamp.newt.MonitorDevice.getOrientationTo ( final MonitorDevice  other,
final int  move_diff[] 
)

Returns the orientation of this monitor to the other.

Parameters
otherthe other monitor
move_diffint[2] to store the move delta for each axis from this-monitor to the other.
Returns
Orientation of this-monitor to the other

Definition at line 166 of file MonitorDevice.java.

Here is the call graph for this function:

◆ getOriginalMode()

final MonitorMode com.jogamp.newt.MonitorDevice.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().

Definition at line 395 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getPixelScale()

float[] com.jogamp.newt.MonitorDevice.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[])

Definition at line 442 of file MonitorDevice.java.

◆ getPixelsPerMM() [1/2]

final float[] com.jogamp.newt.MonitorDevice.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, see mmToInch(float[]).

Parameters
ppmmStorefloat[2] storage for the ppmm result
Returns
the passed storage containing the ppmm for chaining
See also
mmToInch(float[])

Definition at line 309 of file MonitorDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPixelsPerMM() [2/2]

final float[] com.jogamp.newt.MonitorDevice.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
mode
ppmmStorefloat[2] storage for the ppmm result
Returns
the passed storage containing the ppmm for chaining

Definition at line 323 of file MonitorDevice.java.

Here is the call graph for this function:

◆ getScreen()

final Screen com.jogamp.newt.MonitorDevice.getScreen ( )

Returns the Screen owning this monitor.

Definition at line 240 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getSizeMM()

final DimensionImmutable com.jogamp.newt.MonitorDevice.getSizeMM ( )
Returns
the immutable monitor size in millimeters.

Definition at line 294 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getSupportedModes()

final List< MonitorMode > com.jogamp.newt.MonitorDevice.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!

Definition at line 409 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getViewport()

final RectangleImmutable com.jogamp.newt.MonitorDevice.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()

Definition at line 420 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ getViewportInWindowUnits()

final RectangleImmutable com.jogamp.newt.MonitorDevice.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()

Definition at line 431 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ hashCode()

final int com.jogamp.newt.MonitorDevice.hashCode ( )

Returns a combined hash code of it's elements:

  • nativeID

Definition at line 269 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ inchToMM() [1/3]

static float com.jogamp.newt.MonitorDevice.inchToMM ( final float  ppinch)
static

Converts [1/inch] to [1/mm].

Parameters
ppinch[1/inch] value
Returns
return [1/mm] value

Definition at line 385 of file MonitorDevice.java.

◆ inchToMM() [2/3]

static float[] com.jogamp.newt.MonitorDevice.inchToMM ( final float[]  ppinch)
static

Converts [1/inch] to [1/mm] in place.

Parameters
ppinchfloat[2] [1/inch] value, modified
Returns
return [1/mm] value

Definition at line 375 of file MonitorDevice.java.

◆ inchToMM() [3/3]

static float[] com.jogamp.newt.MonitorDevice.inchToMM ( final float[]  result,
final float[]  ppinch 
)
static

Converts [1/inch] to [1/mm] in place.

Parameters
ppinchfloat[2] [1/inch] value, unmodified
Returns
return [1/mm] value

Definition at line 365 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ isClone()

final boolean com.jogamp.newt.MonitorDevice.isClone ( )
Returns
true if this device represents a clone, otherwise return false.

Definition at line 283 of file MonitorDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isModeChangedByUs()

final boolean com.jogamp.newt.MonitorDevice.isModeChangedByUs ( )

Returns true</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.

Definition at line 507 of file MonitorDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOriginalMode()

final boolean com.jogamp.newt.MonitorDevice.isOriginalMode ( )

Definition at line 495 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ isPrimary()

final boolean com.jogamp.newt.MonitorDevice.isPrimary ( )

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

See also
Screen::getPrimaryMonitor()

Definition at line 289 of file MonitorDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmToInch() [1/3]

static float com.jogamp.newt.MonitorDevice.mmToInch ( final float  ppmm)
static

Converts [1/mm] to [1/inch].

Parameters
ppmm[1/mm] value
Returns
return [1/inch] value

Definition at line 356 of file MonitorDevice.java.

◆ mmToInch() [2/3]

static float[] com.jogamp.newt.MonitorDevice.mmToInch ( final float[]  ppmm)
static

Converts [1/mm] to [1/inch] in place.

Parameters
ppmmfloat[2] [1/mm] value, modified
Returns
return [1/inch] value

Definition at line 346 of file MonitorDevice.java.

◆ mmToInch() [3/3]

static float[] com.jogamp.newt.MonitorDevice.mmToInch ( final float[]  result,
final float[]  ppmm 
)
static

Converts [1/mm] to [1/inch] from ppmm into result.

Parameters
ppmmfloat[2] [1/mm] value, unmodified
Returns
return result w/ [1/inch] value

Definition at line 336 of file MonitorDevice.java.

Here is the caller graph for this function:

◆ queryCurrentMode()

abstract MonitorMode com.jogamp.newt.MonitorDevice.queryCurrentMode ( ) throws IllegalStateException
abstract

Returns the current MonitorMode resulting from a native query.

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

Exceptions
IllegalStateExceptionif the associated screen is not valid natively.
See also
getCurrentMode()
Here is the caller graph for this function:

◆ setCurrentMode()

abstract boolean com.jogamp.newt.MonitorDevice.setCurrentMode ( MonitorMode  mode) throws IllegalStateException
abstract

Set the current com.jogamp.newt.MonitorMode.

This method is lifecycle heavy.

Parameters
modeto be made current, must be element of the list getSupportedModes() and Screen#getMonitorModes().
Returns
true if successful, otherwise false
Exceptions
IllegalStateExceptionif the associated screen is not valid natively.
Here is the caller graph for this function:

◆ toString()

String com.jogamp.newt.MonitorDevice.toString ( )

Definition at line 542 of file MonitorDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unionOfViewports()

static void com.jogamp.newt.MonitorDevice.unionOfViewports ( final Rectangle  viewport,
final Rectangle  viewportInWindowUnits,
final List< MonitorDevice monitors 
)
static

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

Parameters
viewportstorage for result in pixel units, maybe null
viewportInWindowUnitsstorage for result in window units, maybe null
monitorsgiven list of monitors

Definition at line 466 of file MonitorDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ currentMode

MonitorMode com.jogamp.newt.MonitorDevice.currentMode
protected

Definition at line 85 of file MonitorDevice.java.

◆ DEFAULT_MODE_BPP

final int com.jogamp.newt.MonitorDevice.DEFAULT_MODE_BPP
static

Bits per pixel of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62.

Customizable via property newt.monitor.bpp.

Definition at line 99 of file MonitorDevice.java.

◆ DEFAULT_MODE_BPP_OVERRIDE

final boolean com.jogamp.newt.MonitorDevice.DEFAULT_MODE_BPP_OVERRIDE
static

True if DEFAULT_MODE_BPP is set by properties.

Definition at line 101 of file MonitorDevice.java.

◆ DEFAULT_MODE_PIXEL_SIZE

final DimensionImmutable com.jogamp.newt.MonitorDevice.DEFAULT_MODE_PIXEL_SIZE
static

Pixel size of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62.

Customizable via property newt.monitor.pxwidth and newt.monitor.pxheight.

Definition at line 89 of file MonitorDevice.java.

◆ DEFAULT_MODE_PIXEL_SIZE_OVERRIDE

final boolean com.jogamp.newt.MonitorDevice.DEFAULT_MODE_PIXEL_SIZE_OVERRIDE
static

True if DEFAULT_MODE_PIXEL_SIZE is set by properties.

Definition at line 91 of file MonitorDevice.java.

◆ DEFAULT_MODE_REFRESH

final int com.jogamp.newt.MonitorDevice.DEFAULT_MODE_REFRESH
static

Refresh rate of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62.

Customizable via property newt.monitor.refresh.

Definition at line 94 of file MonitorDevice.java.

◆ DEFAULT_MODE_REFRESH_OVERRIDE

final boolean com.jogamp.newt.MonitorDevice.DEFAULT_MODE_REFRESH_OVERRIDE
static

True if DEFAULT_MODE_REFRESH is set by properties.

Definition at line 96 of file MonitorDevice.java.

◆ DEFAULT_SCREEN_MM_SIZE

final DimensionImmutable com.jogamp.newt.MonitorDevice.DEFAULT_SCREEN_MM_SIZE
static

Display size in millimeter of default Monitor 1920x1080 32bpp @ 60Hz, size 421x237 mm, dpi 93.60 x 93.62.

Customizable via property newt.monitor.mmwidth.

Definition at line 104 of file MonitorDevice.java.

◆ DEFAULT_SCREEN_MM_SIZE_OVERRIDE

final boolean com.jogamp.newt.MonitorDevice.DEFAULT_SCREEN_MM_SIZE_OVERRIDE
static

True if DEFAULT_SCREEN_MM_SIZE_OVERRIDE is set by properties.

Definition at line 106 of file MonitorDevice.java.

◆ isClone

boolean com.jogamp.newt.MonitorDevice.isClone
protected

Definition at line 83 of file MonitorDevice.java.

◆ isPrimary

boolean com.jogamp.newt.MonitorDevice.isPrimary
protected

Definition at line 84 of file MonitorDevice.java.

◆ modeChanged

boolean com.jogamp.newt.MonitorDevice.modeChanged
protected

Definition at line 86 of file MonitorDevice.java.

◆ name

final String com.jogamp.newt.MonitorDevice.name
protected

Definition at line 76 of file MonitorDevice.java.

◆ nativeHandle

final long com.jogamp.newt.MonitorDevice.nativeHandle
protected

Definition at line 74 of file MonitorDevice.java.

◆ nativeId

final int com.jogamp.newt.MonitorDevice.nativeId
protected

Definition at line 75 of file MonitorDevice.java.

◆ originalMode

final MonitorMode com.jogamp.newt.MonitorDevice.originalMode
protected

Definition at line 78 of file MonitorDevice.java.

◆ pixelScale

final float [] com.jogamp.newt.MonitorDevice.pixelScale
protected

Definition at line 80 of file MonitorDevice.java.

◆ screen

final Screen com.jogamp.newt.MonitorDevice.screen
protected

Definition at line 73 of file MonitorDevice.java.

◆ sizeMM

final DimensionImmutable com.jogamp.newt.MonitorDevice.sizeMM
protected

Definition at line 77 of file MonitorDevice.java.

◆ supportedModes

final ArrayHashSet<MonitorMode> com.jogamp.newt.MonitorDevice.supportedModes
protected

Definition at line 79 of file MonitorDevice.java.

◆ viewportPU

final Rectangle com.jogamp.newt.MonitorDevice.viewportPU
protected

Definition at line 81 of file MonitorDevice.java.

◆ viewportWU

final Rectangle com.jogamp.newt.MonitorDevice.viewportWU
protected

Definition at line 82 of file MonitorDevice.java.


The documentation for this class was generated from the following file: