aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/MonitorDevice.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
index 28d9f53a1..2d1d912c7 100644
--- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java
+++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
@@ -33,7 +33,7 @@ import java.util.List;
import javax.media.nativewindow.util.DimensionImmutable;
import javax.media.nativewindow.util.Rectangle;
import javax.media.nativewindow.util.RectangleImmutable;
-
+import javax.media.nativewindow.util.SurfaceSize;
import com.jogamp.common.util.ArrayHashSet;
/**
@@ -119,6 +119,32 @@ public abstract class MonitorDevice {
}
/**
+ * Stores the <i>pixels per millimeter</i> value according to <i>current</i> {@link MonitorMode}
+ * {@link SurfaceSize#getResolution() SurfaceSize's resolution} in the given storage <code>ppmmStore</code>.
+ * <p>
+ * To convert the result to <i>dpi</i>, i.e. dots-per-inch, multiply both components with <code>25.4f</code>.
+ * </p>
+ */
+ public final void getPixelsPerMM(final float[] ppmmStore) {
+ final MonitorMode mode = getCurrentMode();
+ getPixelsPerMM(mode, ppmmStore);
+ }
+
+ /**
+ * Stores the <i>pixels per millimeter</i> value according to the given {@link MonitorMode}
+ * {@link SurfaceSize#getResolution() SurfaceSize's resolution} in the given storage <code>ppmmStore</code>.
+ * <p>
+ * To convert the result to <i>dpi</i>, i.e. dots-per-inch, multiply both components with <code>25.4f</code>.
+ * </p>
+ */
+ public final void getPixelsPerMM(final MonitorMode mode, final float[] ppmmStore) {
+ final DimensionImmutable sdim = getSizeMM();
+ final DimensionImmutable spix = mode.getSurfaceSize().getResolution();
+ ppmmStore[0] = (float)spix.getWidth() / (float)sdim.getWidth();
+ ppmmStore[1] = (float)spix.getHeight() / (float)sdim.getHeight();
+ }
+
+ /**
* Returns the immutable original {@link com.jogamp.newt.MonitorMode}, as used at NEWT initialization.
* <p>
* The returned {@link MonitorMode} is element of the lists {@link #getSupportedModes()} and {@link Screen#getMonitorModes()}.