public abstract class MonitorDevice extends Object
DimensionImmutable
size in [mm]MonitorMode
original modeList<MonitorMode>
supportedModesMonitorMode
current modeRectangleImmutable
viewport (rotated)All values of this interface are represented in pixel units, if not stated otherwise.
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[] |
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 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 current
rectangular portion
of the rotated virtual Screen size in pixel units
represented by this monitor, i.e. |
RectangleImmutable |
getViewportInWindowUnits()
Returns the current
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 |
isClone() |
boolean |
isModeChangedByUs()
Returns
true if the |
boolean |
isOriginalMode() |
boolean |
isPrimary()
Returns
true if this device represents the primary device, otherwise return false . |
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. |
public final boolean equals(Object obj)
MonitorDevice
objects
by evaluating equality of it's components:nativeID
public final int hashCode()
nativeID
public final int getId()
public final boolean isClone()
true
if this device represents a clone, otherwise return false
.public final boolean isPrimary()
true
if this device represents the primary device, otherwise return false
.Screen.getPrimaryMonitor()
public final DimensionImmutable getSizeMM()
public final float[] getPixelsPerMM(float[] ppmmStore)
mode
's
surface resolution
.
To convert the result to dpi, i.e. dots-per-inch, multiply both components with 25.4f
.
ppmmStore
- float[2] storage for the ppmm resultpublic final float[] getPixelsPerMM(MonitorMode mode, float[] ppmmStore)
mode
's
surface resolution
.
To convert the result to dpi, i.e. dots-per-inch, multiply both components with 25.4f
.
mode
- ppmmStore
- float[2] storage for the ppmm resultpublic final MonitorMode getOriginalMode()
MonitorMode
, as used at NEWT initialization.
The returned MonitorMode
is element of the lists getSupportedModes()
and Screen.getMonitorModes()
.
public final List<MonitorMode> getSupportedModes()
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!
public final RectangleImmutable getViewport()
rectangular
portion
of the rotated virtual Screen
size in pixel units
represented by this monitor, i.e. top-left origin and size.#getPixelScale()
,
Screen.getViewport()
public final RectangleImmutable getViewportInWindowUnits()
rectangular
portion
of the rotated virtual Screen
size in window units
represented by this monitor, i.e. top-left origin and size.#getPixelScale()
,
Screen.getViewportInWindowUnits()
public float[] getPixelScale(float[] result)
public final boolean contains(int x, int y)
true
if given screen coordinates in pixel units
are contained by this viewport
, otherwise false
.x
- x-coord in pixel unitsy
- y-coord in pixel unitspublic static void unionOfViewports(Rectangle viewport, Rectangle viewportInWindowUnits, List<MonitorDevice> monitors)
viewport
in pixel- and window units.viewport
- storage for result in pixel units, maybe nullviewportInWindowUnits
- storage for result in window units, maybe nullmonitors
- given list of monitorspublic final boolean isOriginalMode()
public final boolean isModeChangedByUs()
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.
public final MonitorMode getCurrentMode()
MonitorMode
w/o native query.
The returned MonitorMode
is element of the lists getSupportedModes()
and Screen.getMonitorModes()
.
queryCurrentMode()
public abstract MonitorMode queryCurrentMode() throws IllegalStateException
MonitorMode
resulting from a native query.
The returned MonitorMode
is element of the lists getSupportedModes()
and Screen.getMonitorModes()
.
IllegalStateException
- if the associated screen
is not valid natively
.getCurrentMode()
public abstract boolean setCurrentMode(MonitorMode mode) throws IllegalStateException
MonitorMode
.
This method is lifecycle heavy.
mode
- to be made current, must be element of the list getSupportedModes()
and Screen.getMonitorModes()
.IllegalStateException
- if the associated screen
is not valid natively
.Copyright 2010 JogAmp Community.