| 82 GR.fillrect(vp...) |
82 GR.fillrect(vp...) |
| 83 GR.selntran(1) |
83 GR.selntran(1) |
| 84 GR.restorestate() |
84 GR.restorestate() |
| 85 end |
85 end |
| 86 |
86 |
| 87 function do_visualise(imgs; refresh=true, fullscreen=false) |
87 function do_visualise(imgs; refresh=true, fullscreen=false, windowsize=nothing) |
| 88 n = length(imgs) |
88 n = length(imgs) |
| 89 # Get device dimensions in metres and pixels |
89 # Get device dimensions in metres and pixels |
| 90 scrw, scrh, pw, ph = GR.inqdspsize() |
90 scrw, scrh, pw, ph = GR.inqdspsize() |
| 91 imgaspect = n > 0 ? float(size(imgs[1], 1))/float(size(imgs[1], 2)) : 1 |
91 imgaspect = n > 0 ? float(size(imgs[1], 1))/float(size(imgs[1], 2)) : 1 |
| 92 # Scaling to maximum size window |
92 # Scaling to maximum size window |
| 94 # Set up window and transformations |
94 # Set up window and transformations |
| 95 GR.clearws() |
95 GR.clearws() |
| 96 GR.setscale(0); |
96 GR.setscale(0); |
| 97 GR.selntran(1) |
97 GR.selntran(1) |
| 98 # - First OS window size |
98 # - First OS window size |
| 99 if fullscreen |
99 if !isnothing(windowsize) |
| |
100 w, h = float.(windowsize) |
| |
101 elseif fullscreen |
| 100 w, h = float(scrw), float(scrh) |
102 w, h = float(scrw), float(scrh) |
| 101 elseif scrw/n>scrh |
103 elseif scrw/n>scrh |
| 102 w, h = float(sc*scrh*n), float(sc*scrh*imgaspect) |
104 w, h = float(sc*scrh*n), float(sc*scrh*imgaspect) |
| 103 else |
105 else |
| 104 w, h = float(sc*scrw), float(sc*scrw/n*imgaspect) |
106 w, h = float(sc*scrw), float(sc*scrw/n*imgaspect) |
| 123 x0 = (canvas[1]+canvas[2])/2 |
125 x0 = (canvas[1]+canvas[2])/2 |
| 124 hh = (canvas[4]-canvas[3])/2 |
126 hh = (canvas[4]-canvas[3])/2 |
| 125 x1 = x0-hh*(n/imgaspect) |
127 x1 = x0-hh*(n/imgaspect) |
| 126 x2 = x0+hh*(n/imgaspect) |
128 x2 = x0+hh*(n/imgaspect) |
| 127 GR.setviewport(x1, x2, canvas[3], canvas[4]) |
129 GR.setviewport(x1, x2, canvas[3], canvas[4]) |
| 128 end |
130 end |
| 129 GR.setwindow(0, n, 0, 1) |
131 GR.setwindow(0, n, 0, 1) |
| 130 # Clear background |
132 # Clear background |
| 131 # Plot images |
133 # Plot images |
| 132 for i=1:n |
134 for i=1:n |
| 133 im = imgs[i]' |
135 im = imgs[i]' |