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
DimensionImmutablesize in [mm]MonitorModeoriginal modeList<MonitorMode>supportedModes
- Mutable
MonitorModecurrent modeRectangleImmutableviewport (rotated)- pixel-scale (rotated)
All values of this interface are represented in pixel units, if not stated otherwise.
- Immutable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancontains(int x, int y)Returnstrueif given screen coordinates in pixel units are contained by thisviewport, otherwisefalse.booleanequals(Object obj)Tests equality of twoMonitorDeviceobjects by evaluating equality of it's components:
nativeIDMonitorModegetCurrentMode()Returns the cached currentMonitorModew/o native query.intgetId()MonitorModegetOriginalMode()Returns the immutable originalMonitorMode, as used at NEWT initialization.float[]getPixelScale(float[] result)Returns the current rotated pixel-scale of this monitor, i.e.float[]getPixelsPerMM(float[] ppmmStore)Returns the pixels per millimeter value according to the currentmode'ssurface resolution.float[]getPixelsPerMM(MonitorMode mode, float[] ppmmStore)Returns the pixels per millimeter value according to the givenmode'ssurface resolution.ScreengetScreen()Returns theScreenowning this monitor.DimensionImmutablegetSizeMM()List<MonitorMode>getSupportedModes()Returns a list of immutableMonitorModes supported by this monitor.RectangleImmutablegetViewport()Returns the currentrectangularportion of the rotated virtualScreensize in pixel units represented by this monitor, i.e.RectangleImmutablegetViewportInWindowUnits()Returns the currentrectangularportion of the rotated virtualScreensize in window units represented by this monitor, i.e.inthashCode()Returns a combined hash code of it's elements:
nativeIDbooleanisClone()booleanisModeChangedByUs()Returnstrue if theMonitorModehas been changed programmatic via this API only, otherwisefalse.booleanisOriginalMode()booleanisPrimary()Returnstrueif this device represents the primary device, otherwise returnfalse.abstract MonitorModequeryCurrentMode()Returns the currentMonitorModeresulting from a native query.abstract booleansetCurrentMode(MonitorMode mode)Set the currentMonitorMode.StringtoString()static voidunionOfViewports(Rectangle viewport, Rectangle viewportInWindowUnits, List<MonitorDevice> monitors)Calculates the union of the given monitor'sviewportin pixel- and window units.
-
-
-
Method Detail
-
equals
public final boolean equals(Object obj)
Tests equality of twoMonitorDeviceobjects by evaluating equality of it's components:
nativeID
-
hashCode
public final int hashCode()
Returns a combined hash code of it's elements:
nativeID
-
getId
public final int getId()
- Returns:
- the immutable unique native Id of this monitor device.
-
isClone
public final boolean isClone()
- Returns:
trueif this device represents a clone, otherwise returnfalse.
-
isPrimary
public final boolean isPrimary()
Returnstrueif this device represents the primary device, otherwise returnfalse.- See Also:
Screen.getPrimaryMonitor()
-
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 currentmode'ssurface 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 givenmode'ssurface 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 originalMonitorMode, as used at NEWT initialization.The returned
MonitorModeis element of the listsgetSupportedModes()andScreen.getMonitorModes().
-
getSupportedModes
public final List<MonitorMode> getSupportedModes()
Returns a list of immutableMonitorModes 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 currentrectangularportion of the rotated virtualScreensize in pixel units represented by this monitor, i.e. top-left origin and size.- See Also:
#getPixelScale(),Screen.getViewport()
-
getViewportInWindowUnits
public final RectangleImmutable getViewportInWindowUnits()
Returns the currentrectangularportion of the rotated virtualScreensize in window units represented by this monitor, i.e. top-left origin and size.- See Also:
#getPixelScale(),Screen.getViewportInWindowUnits()
-
getPixelScale
public float[] getPixelScale(float[] result)
Returns the current rotated pixel-scale of this monitor, i.e. horizontal and vertical.
-
contains
public final boolean contains(int x, int y)Returnstrueif given screen coordinates in pixel units are contained by thisviewport, otherwisefalse.- Parameters:
x- x-coord in pixel unitsy- y-coord in pixel units
-
unionOfViewports
public static void unionOfViewports(Rectangle viewport, Rectangle viewportInWindowUnits, List<MonitorDevice> monitors)
Calculates the union of the given monitor'sviewportin pixel- and window units.- Parameters:
viewport- storage for result in pixel units, maybe nullviewportInWindowUnits- storage for result in window units, maybe nullmonitors- given list of monitors
-
isOriginalMode
public final boolean isOriginalMode()
-
isModeChangedByUs
public final boolean isModeChangedByUs()
Returnstrue if theMonitorModehas been changed programmatic via this API only, otherwisefalse.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 currentMonitorModew/o native query.The returned
MonitorModeis element of the listsgetSupportedModes()andScreen.getMonitorModes().- See Also:
queryCurrentMode()
-
queryCurrentMode
public abstract MonitorMode queryCurrentMode() throws IllegalStateException
Returns the currentMonitorModeresulting from a native query.The returned
MonitorModeis element of the listsgetSupportedModes()andScreen.getMonitorModes().- Throws:
IllegalStateException- if theassociated screenis notvalid natively.- See Also:
getCurrentMode()
-
setCurrentMode
public abstract boolean setCurrentMode(MonitorMode mode) throws IllegalStateException
Set the currentMonitorMode.This method is lifecycle heavy.
- Parameters:
mode- to be made current, must be element of the listgetSupportedModes()andScreen.getMonitorModes().- Returns:
- true if successful, otherwise false
- Throws:
IllegalStateException- if theassociated screenis notvalid natively.
-
-