diff --git a/404.html b/404.html
new file mode 100644
index 0000000..b71f010
--- /dev/null
+++ b/404.html
@@ -0,0 +1,15 @@
+---
+permalink: /404.html
+---
+
+
+
+
+ Loading..
+
+
+
+
+
diff --git a/README.md b/README.md
index 3f3ca9d..4a1d92b 100644
--- a/README.md
+++ b/README.md
@@ -38,10 +38,7 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
## Library
-- `(import path shape ~alpha)` Imports a graphic file with format.
-- `(export path ~format ~quality)` Exports a graphic file with format.
-- `(open path ~ratio)` Imports a graphic file and resizes the frame.
-- `(exit ~force)` Exits Ronin.
+- `(export ~name ~format ~quality)` Exports a graphic file with format.
- `(pos ~x ~y)` Returns a position shape.
- `(line ax ay bx by)` Returns a line shape.
- `(size w h)` Returns a size shape.
@@ -126,12 +123,6 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
- `(blur)` Returns the blur kernel.
- `(sharpen)` Returns the sharpen kernel.
- `(edge)` Returns the edge kernel.
-- `(dir ~path)` Returns the content of a directory.
-- `(file ~path)` Returns the content of a file.
-- `(dirpath ~path)` Returns the path of a directory.
-- `(filepath ~path)` Returns the path of a file.
-- `(dirname ~path)` Returns the name of a folder.
-- `(filename ~path)` Returns the name of a file.
- `(offset a b)` Offsets pos a with pos b, returns a.
- `(distance a b)` Get distance between positions.
- `(echo ...args)` Print arguments to interface.
@@ -142,6 +133,19 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
- `(test name a b)`
- `(benchmark fn)` Logs time taken to execute a function.
+### In Development
+
+- `(import path shape ~alpha)` Imports a graphic file with format.
+- `(export path ~format ~quality)` Exports a graphic file with format.
+- `(open path ~ratio)` Imports a graphic file and resizes the frame.
+- `(exit ~force)` Exits Ronin.
+- `(dir ~path)` Returns the content of a directory.
+- `(file ~path)` Returns the content of a file.
+- `(dirpath ~path)` Returns the path of a directory.
+- `(filepath ~path)` Returns the path of a file.
+- `(dirname ~path)` Returns the name of a folder.
+- `(filename ~path)` Returns the name of a file.
+
diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js
index db2f25b..0d580fd 100644
--- a/desktop/sources/scripts/library.js
+++ b/desktop/sources/scripts/library.js
@@ -10,17 +10,17 @@ function Library (ronin) {
// IO
this.import = async (path, shape, alpha = 1) => { // Imports a graphic file with format.
- const img = new Image()
- img.src = path
- return ronin.surface.draw(img, shape, alpha)
+ // const img = new Image()
+ // img.src = path
+ // return ronin.surface.draw(img, shape, alpha)
}
- this.export = (path, quality = 1.0) => { // Exports a graphic file with format.
- // if (!path) { console.warn('Missing export path'); return path }
- // const dataUrl = ronin.surface.el.toDataURL(path.indexOf('.jpg') > -1 ? 'image/jpeg' : path.indexOf('.png') > -1 ? 'image/png' : format, quality)
- // const data = dataUrl.replace(/^data:image\/png;base64,/, '').replace(/^data:image\/jpeg;base64,/, '')
- // fs.writeFileSync(path, data, 'base64')
- // return path
+ this.export = (name = 'export', type = 'image/png', quality = 1.0) => { // Exports a graphic file with format.
+ const base64 = ronin.surface.el.toDataURL(type, quality)
+ const link = document.createElement('a')
+ link.setAttribute('href', base64)
+ link.setAttribute('download', type === 'image/png' ? name + '.png' : name + '.jpg')
+ link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
}
this.open = async (path, ratio = 1) => { // Imports a graphic file and resizes the frame.
diff --git a/desktop/sources/scripts/ronin.js b/desktop/sources/scripts/ronin.js
index 3d0447d..2c48f6b 100644
--- a/desktop/sources/scripts/ronin.js
+++ b/desktop/sources/scripts/ronin.js
@@ -83,11 +83,7 @@ function Ronin () {
requestAnimationFrame(() => this.loop())
}
- this.reset = function () {
- this.theme.reset()
- }
-
- this.log = function (...msg) {
+ this.log = (...msg) => {
this.commander.setStatus(msg.reduce((acc, val) => {
return acc + JSON.stringify(val).replace(/"/g, '').trim() + ' '
}, ''))
diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js
index 86def2a..b57db01 100644
--- a/desktop/sources/scripts/surface.js
+++ b/desktop/sources/scripts/surface.js
@@ -293,10 +293,11 @@ function Surface (ronin) {
}
this.fitWindow = function (size) {
- const win = require('electron').remote.getCurrentWindow()
- const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
- if (size.w < 10 || size.h < 10) { return }
- win.setSize(Math.floor((size.w / this.ratio) + pad.w), Math.floor((size.h / this.ratio) + pad.h), true)
+ console.log('TODO')
+ // const win = require('electron').remote.getCurrentWindow()
+ // const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
+ // if (size.w < 10 || size.h < 10) { return }
+ // win.setSize(Math.floor((size.w / this.ratio) + pad.w), Math.floor((size.h / this.ratio) + pad.h), true)
}
this.maximize = () => {
diff --git a/examples/basics/benchmark.lisp b/examples/basics/benchmark.lisp
index c4fe494..5f19776 100644
--- a/examples/basics/benchmark.lisp
+++ b/examples/basics/benchmark.lisp
@@ -57,13 +57,4 @@
; Interop
(test "interop" ((of (of (js) "Math") "max") 2 4) 4)
- (test "recursive key selector" ((of (js) "Math" "max") 2 4) 4)
-
-; fs
-
-; filesystem
-
-(echo (filepath))
-(echo (dirpath))
-(echo (file))
-(echo (dir))
+ (test "recursive key selector" ((of (js) "Math" "max") 2 4) 4)
\ No newline at end of file
diff --git a/examples/basics/recursive.lisp b/examples/basics/recursive.lisp
deleted file mode 100644
index c532230..0000000
--- a/examples/basics/recursive.lisp
+++ /dev/null
@@ -1,16 +0,0 @@
-; recursive
-
-(clear)
-(defn rec
- (v)
- (if
- (gt v 0)
- (
- (stroke
- (circle
- (mul 5 v)
- (mul 5 v)
- (mul 5 v)) "red" 1)
- (rec
- (sub v 5)))))
-(rec 100)
\ No newline at end of file