aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-04-13 06:29:16 +0200
committerSven Gothel <[email protected]>2023-04-13 06:29:16 +0200
commit0017e5f6e7e8410d566dcefd9f42ffd0d4fc61e7 (patch)
tree5ac0b11ced005c1c4f273fea9d1cc8d759420cc6 /src/graphui/classes
parent823fe11a49ac2160da86cdf894c84efa9fb1ae2c (diff)
GraphUI Scene.screenshot(): Add convenient variant to be executed on-display call. FontView stays open and issues a screenshot.
Diffstat (limited to 'src/graphui/classes')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Scene.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
index 7d4e10574..ded1cfa61 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
@@ -1069,7 +1069,16 @@ public final class Scene implements Container, GLEventListener {
/**
* Write current read drawable (screen) to a PNG file.
+ *
+ * Best to be {@link GLAutoDrawable#invoke(boolean, GLRunnable) invoked on the display call},
+ * see {@link #screenshot(boolean, int, String)}.
+ *
+ * @param gl current GL object
+ * @param renderModes Graph renderModes
+ * @param prefix filename prefix
+ *
* @see #getScreenshotCount()
+ * @see #screenshot(boolean, int, String)
*/
public void screenshot(final GL gl, final int renderModes, final String prefix) {
final RegionRenderer renderer = getRenderer();
@@ -1085,6 +1094,25 @@ public final class Scene implements Container, GLEventListener {
}
private int shotCount = 0;
+ /**
+ * Write current read drawable (screen) to a PNG file on {@link GLAutoDrawable#invoke(boolean, GLRunnable) on the display call}.
+ *
+ * @param wait if true block until execution of screenshot {@link GLRunnable} is finished, otherwise return immediately w/o waiting
+ * @param renderModes Graph renderModes
+ * @param prefix filename prefix
+ *
+ * @see #getScreenshotCount()
+ * @see #screenshot(GL, int, String)
+ */
+ public void screenshot(final boolean wait, final int renderModes, final String prefix) {
+ if( null != cDrawable ) {
+ cDrawable.invoke(wait, (drawable) -> {
+ screenshot(drawable.getGL(), renderModes, prefix);
+ return true;
+ });
+ }
+ }
+
/** Return the number of {@link #screenshot(GL, int, String)}s being taken. */
public int getScreenshotCount() { return shotCount; }