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 60
dcfc38ade15b
parent 45
097f95638dba
child 62
a6eed11d13df

windowsize parameter

src/Visualise.jl file | annotate | diff | comparison | revisions
--- a/src/Visualise.jl	Fri Oct 23 18:00:53 2020 -0500
+++ b/src/Visualise.jl	Wed Dec 02 12:54:43 2020 -0500
@@ -89,7 +89,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()
@@ -101,7 +101,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)
@@ -130,7 +132,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