Class MonitorDevice
- nativeId
DimensionImmutablesize in [mm]MonitorModeoriginal modeList<MonitorMode>supportedModes
MonitorModecurrent modeRectangleImmutableviewport (rotated)- pixel-scale (rotated)
All values of this interface are represented in pixel units, if not stated otherwise.
-
Method Summary
Modifier and TypeMethodDescriptionfinal booleancontains(int x, int y) Returnstrueif given screen coordinates in pixel units are contained by thisviewport, otherwisefalse.final booleanTests equality of twoMonitorDeviceobjects by evaluating equality of it's components:
nativeIDfinal MonitorModeReturns the cached currentMonitorModew/o native query.final intgetId()final MonitorModeReturns the immutable originalMonitorMode, as used at NEWT initialization.float[]getPixelScale(float[] result) Returns the current rotated pixel-scale of this monitor, i.e.final float[]getPixelsPerMM(float[] ppmmStore) Returns the pixels per millimeter value according to the currentmode'ssurface resolution.final float[]getPixelsPerMM(MonitorMode mode, float[] ppmmStore) Returns the pixels per millimeter value according to the givenmode'ssurface resolution.final ScreenReturns theScreenowning this monitor.final DimensionImmutablefinal List<MonitorMode>Returns a list of immutableMonitorModes supported by this monitor.final RectangleImmutableReturns the currentrectangularportion of the rotated virtualScreensize in pixel units represented by this monitor, i.e.final RectangleImmutableReturns the currentrectangularportion of the rotated virtualScreensize in window units represented by this monitor, i.e.final inthashCode()Returns a combined hash code of it's elements:
nativeIDfinal booleanisClone()final booleanReturnstrue if theMonitorModehas been changed programmatic via this API only, otherwisefalse.final booleanfinal booleanReturnstrueif this device represents the primary device, otherwise returnfalse.abstract MonitorModeReturns the currentMonitorModeresulting from a native query.abstract booleansetCurrentMode(MonitorMode mode) Set the currentMonitorMode.toString()static voidunionOfViewports(Rectangle viewport, Rectangle viewportInWindowUnits, List<MonitorDevice> monitors) Calculates the union of the given monitor'sviewportin pixel- and window units.
-
Method Details
-
getScreen
Returns theScreenowning this monitor. -
equals
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:
-
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
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
Returns the immutable originalMonitorMode, as used at NEWT initialization.The returned
MonitorModeis element of the listsgetSupportedModes()andScreen.getMonitorModes(). -
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
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
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
Returns the cached currentMonitorModew/o native query.The returned
MonitorModeis element of the listsgetSupportedModes()andScreen.getMonitorModes().- See Also:
-
queryCurrentMode
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:
-
setCurrentMode
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.
-
toString
-