Re-implemented (export)
This commit is contained in:
parent
707f056649
commit
ff934f9f16
15
404.html
Normal file
15
404.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
permalink: /404.html
|
||||||
|
---
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Loading..</title>
|
||||||
|
</head>
|
||||||
|
<body style='background:black'>
|
||||||
|
<script>
|
||||||
|
document.location.href = '/index.html'
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
24
README.md
24
README.md
@ -38,10 +38,7 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
|
|||||||
|
|
||||||
## Library
|
## Library
|
||||||
|
|
||||||
- `(import path shape ~alpha)` Imports a graphic file with format.
|
- `(export ~name ~format ~quality)` Exports 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.
|
|
||||||
- `(pos ~x ~y)` Returns a position shape.
|
- `(pos ~x ~y)` Returns a position shape.
|
||||||
- `(line ax ay bx by)` Returns a line shape.
|
- `(line ax ay bx by)` Returns a line shape.
|
||||||
- `(size w h)` Returns a size 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.
|
- `(blur)` Returns the blur kernel.
|
||||||
- `(sharpen)` Returns the sharpen kernel.
|
- `(sharpen)` Returns the sharpen kernel.
|
||||||
- `(edge)` Returns the edge 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.
|
- `(offset a b)` Offsets pos a with pos b, returns a.
|
||||||
- `(distance a b)` Get distance between positions.
|
- `(distance a b)` Get distance between positions.
|
||||||
- `(echo ...args)` Print arguments to interface.
|
- `(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)`
|
- `(test name a b)`
|
||||||
- `(benchmark fn)` Logs time taken to execute a function.
|
- `(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.
|
||||||
|
|
||||||
<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW2.jpg' width='600'/>
|
<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW2.jpg' width='600'/>
|
||||||
|
|
||||||
<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW3.jpg' width='600'/>
|
<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW3.jpg' width='600'/>
|
||||||
|
@ -10,17 +10,17 @@ function Library (ronin) {
|
|||||||
// IO
|
// IO
|
||||||
|
|
||||||
this.import = async (path, shape, alpha = 1) => { // Imports a graphic file with format.
|
this.import = async (path, shape, alpha = 1) => { // Imports a graphic file with format.
|
||||||
const img = new Image()
|
// const img = new Image()
|
||||||
img.src = path
|
// img.src = path
|
||||||
return ronin.surface.draw(img, shape, alpha)
|
// return ronin.surface.draw(img, shape, alpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.export = (path, quality = 1.0) => { // Exports a graphic file with format.
|
this.export = (name = 'export', type = 'image/png', quality = 1.0) => { // Exports a graphic file with format.
|
||||||
// if (!path) { console.warn('Missing export path'); return path }
|
const base64 = ronin.surface.el.toDataURL(type, quality)
|
||||||
// const dataUrl = ronin.surface.el.toDataURL(path.indexOf('.jpg') > -1 ? 'image/jpeg' : path.indexOf('.png') > -1 ? 'image/png' : format, quality)
|
const link = document.createElement('a')
|
||||||
// const data = dataUrl.replace(/^data:image\/png;base64,/, '').replace(/^data:image\/jpeg;base64,/, '')
|
link.setAttribute('href', base64)
|
||||||
// fs.writeFileSync(path, data, 'base64')
|
link.setAttribute('download', type === 'image/png' ? name + '.png' : name + '.jpg')
|
||||||
// return path
|
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.
|
this.open = async (path, ratio = 1) => { // Imports a graphic file and resizes the frame.
|
||||||
|
@ -83,11 +83,7 @@ function Ronin () {
|
|||||||
requestAnimationFrame(() => this.loop())
|
requestAnimationFrame(() => this.loop())
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reset = function () {
|
this.log = (...msg) => {
|
||||||
this.theme.reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
this.log = function (...msg) {
|
|
||||||
this.commander.setStatus(msg.reduce((acc, val) => {
|
this.commander.setStatus(msg.reduce((acc, val) => {
|
||||||
return acc + JSON.stringify(val).replace(/"/g, '').trim() + ' '
|
return acc + JSON.stringify(val).replace(/"/g, '').trim() + ' '
|
||||||
}, ''))
|
}, ''))
|
||||||
|
@ -293,10 +293,11 @@ function Surface (ronin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.fitWindow = function (size) {
|
this.fitWindow = function (size) {
|
||||||
const win = require('electron').remote.getCurrentWindow()
|
console.log('TODO')
|
||||||
const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
|
// const win = require('electron').remote.getCurrentWindow()
|
||||||
if (size.w < 10 || size.h < 10) { return }
|
// const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
|
||||||
win.setSize(Math.floor((size.w / this.ratio) + pad.w), Math.floor((size.h / this.ratio) + pad.h), true)
|
// 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 = () => {
|
this.maximize = () => {
|
||||||
|
@ -58,12 +58,3 @@
|
|||||||
; Interop
|
; Interop
|
||||||
(test "interop" ((of (of (js) "Math") "max") 2 4) 4)
|
(test "interop" ((of (of (js) "Math") "max") 2 4) 4)
|
||||||
(test "recursive key selector" ((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))
|
|
||||||
|
@ -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)
|
|
Loading…
x
Reference in New Issue
Block a user