-
-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathpreview.go
More file actions
29 lines (26 loc) · 641 Bytes
/
preview.go
File metadata and controls
29 lines (26 loc) · 641 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package caire
import (
"os"
)
// showPreview spawns a new Gio GUI window and updates its content with the resized image received from a channel.
func (p *Processor) showPreview(
imgWorker <-chan worker,
errChan chan<- error,
guiWindow struct {
width int
height int
},
) {
var gui = NewGUI(guiWindow.width, guiWindow.height)
gui.proc = p
gui.process.worker = imgWorker
// Run the Gio GUI app in a separate goroutine
go func() {
if err := gui.Run(); err != nil {
errChan <- err
}
// It's important to call os.Exit(0) in order to terminate
// the execution of the GUI app when pressing ESC key.
os.Exit(0)
}()
}