diff --git a/SilicaViewer/AppDelegate.swift b/SilicaViewer/AppDelegate.swift
index 7519fca..03608c2 100644
--- a/SilicaViewer/AppDelegate.swift
+++ b/SilicaViewer/AppDelegate.swift
@@ -18,5 +18,42 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
return true
}
+
+ @IBAction func exportAction(_ sender: Any) {
+ let document = NSApplication.shared.keyWindow?.windowController?.document as? Document;
+
+ let savePanel = NSSavePanel()
+ savePanel.title = "Save"
+ savePanel.allowedFileTypes = ["public.png"]
+ savePanel.begin { (result) in
+ if result.rawValue == NSApplication.ModalResponse.OK.rawValue {
+ let canvas = document?.makeComposite()
+ let canvasTiff = canvas?.tiffRepresentation
+ let bitmapImage = NSBitmapImageRep(data: canvasTiff!)
+ let canvasPng = bitmapImage!.representation(using: .png, properties: [:])
+
+ try? canvasPng?.write(to: savePanel.url!)
+ }
+ }
+ }
+
+ @IBAction func exportThumbnailAction(_ sender: Any) {
+ let document = NSApplication.shared.keyWindow?.windowController?.document as? Document;
+
+ let savePanel = NSSavePanel()
+ savePanel.title = "Save Thumbnail"
+ savePanel.allowedFileTypes = ["public.png"]
+ savePanel.begin { (result) in
+ if result.rawValue == NSApplication.ModalResponse.OK.rawValue {
+ let canvas = document?.makeThumbnail()
+ let canvasTiff = canvas?.tiffRepresentation
+ let bitmapImage = NSBitmapImageRep(data: canvasTiff!)
+ let canvasPng = bitmapImage!.representation(using: .png, properties: [:])
+
+ try? canvasPng?.write(to: savePanel.url!)
+ }
+ }
+ }
+
}
diff --git a/SilicaViewer/Base.lproj/Main.storyboard b/SilicaViewer/Base.lproj/Main.storyboard
index 4fa5758..74f8375 100644
--- a/SilicaViewer/Base.lproj/Main.storyboard
+++ b/SilicaViewer/Base.lproj/Main.storyboard
@@ -79,8 +79,16 @@
-
-
+
+