windowsize parameter

Wed, 02 Dec 2020 12:54:43 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Wed, 02 Dec 2020 12:54:43 -0500
changeset 59
7ee6be1823e8
parent 58
4a2c4ee27858
child 61
06cfef2c06c5

windowsize parameter

src/Visualise.jl file | annotate | diff | comparison | revisions
--- a/src/Visualise.jl	Wed Dec 15 10:36:43 2021 +0200
+++ b/src/Visualise.jl	Wed Dec 02 12:54:43 2020 -0500
@@ -84,7 +84,7 @@
     GR.restorestate()
 end
 
-function do_visualise(imgs; refresh=true, fullscreen=false)
+function do_visualise(imgs; refresh=true, fullscreen=false, windowsize=nothing)
     n = length(imgs)
     # Get device dimensions in metres and pixels
     scrw, scrh, pw, ph = GR.inqdspsize()
@@ -96,7 +96,9 @@
     GR.setscale(0);
     GR.selntran(1)
     # - First OS window size
-    if fullscreen
+    if !isnothing(windowsize)
+        w, h = float.(windowsize)
+    elseif fullscreen
         w, h = float(scrw), float(scrh)
     elseif scrw/n>scrh
         w, h = float(sc*scrh*n), float(sc*scrh*imgaspect)
@@ -125,7 +127,7 @@
         x1 = x0-hh*(n/imgaspect)
         x2 = x0+hh*(n/imgaspect)
         GR.setviewport(x1, x2, canvas[3], canvas[4])
-    end    
+    end
     GR.setwindow(0, n, 0, 1)
     # Clear background
     # Plot images

mercurial