*
This commit is contained in:
parent
ca69d99a9c
commit
38f99b3ef8
@ -8,6 +8,7 @@ function Library (client) {
|
||||
|
||||
this.open = async (name, scale = 1) => { // Import a graphic and scale canvas to fit.
|
||||
const img = client.cache.get(name)
|
||||
if (!img) { client.log('No data for ' + name); return }
|
||||
const rect = this.rect(0, 0, img.width * scale, img.height * scale)
|
||||
await this.resize(rect.w, rect.h).then(this.import(name, rect))
|
||||
return rect
|
||||
@ -79,13 +80,13 @@ function Library (client) {
|
||||
|
||||
// Frame
|
||||
|
||||
this.resize = (w = client.surface.bounds().w, h = client.surface.bounds().h, fit = true) => { // Resizes the canvas to target w and h, returns the rect.
|
||||
this.resize = async (w = client.surface.bounds().w, h = client.surface.bounds().h, fit = true) => { // Resizes the canvas to target w and h, returns the rect.
|
||||
if (w === this['get-frame']().w && h === this['get-frame']().h) { return }
|
||||
const rect = { x: 0, y: 0, w, h }
|
||||
const a = document.createElement('img')
|
||||
const b = document.createElement('img')
|
||||
a.src = client.surface.el.toDataURL()
|
||||
client.surface.resizeImage(a, b)
|
||||
await client.surface.resizeImage(a, b)
|
||||
client.surface.resize(rect, fit)
|
||||
return client.surface.draw(b, rect)
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
(clear)
|
||||
(def hor-path "/Users/VillaMoirai/Desktop/hor.jpeg")
|
||||
(def ver-path "/Users/VillaMoirai/Desktop/ver.jpg")
|
||||
; rect
|
||||
(import hor-path
|
||||
(guide (rect 50 50 300 300)))
|
||||
|
||||
(import hor-path
|
||||
(guide (rect 350 50 350 200)))
|
||||
|
||||
(import hor-path
|
||||
(guide (line 700 50 1200 350)))
|
||||
|
||||
(import hor-path
|
||||
(guide (rect 1200 50 200 300)))
|
||||
|
||||
(import ver-path
|
||||
(guide (rect 50 350 300 300)))
|
||||
|
||||
(import ver-path
|
||||
(guide (rect 350 350 350 200)))
|
||||
|
||||
(import ver-path
|
||||
(guide (line 700 350 1200 700)))
|
||||
|
||||
(import ver-path
|
||||
(guide (rect 1200 350 200 300)))
|
@ -1,11 +1,6 @@
|
||||
; Render script for a6000
|
||||
(clear)
|
||||
(def photo-rect
|
||||
(rect 0 0
|
||||
(div 4240 2)
|
||||
(div 2400 2)))
|
||||
(resize photo-rect:w photo-rect:h)
|
||||
(import $path photo-rect)
|
||||
(pixels normalize
|
||||
(pick photo-rect))
|
||||
(export "export" "image/jpeg" 0.9)
|
||||
; Normalize photo colors
|
||||
|
||||
(open $path 0.5)
|
||||
(def average-color
|
||||
(pick))
|
||||
(pixels normalize average-color)
|
7
examples/pixels/sharpen.lisp
Normal file
7
examples/pixels/sharpen.lisp
Normal file
@ -0,0 +1,7 @@
|
||||
; sharpen photo
|
||||
|
||||
(open $path 0.75)
|
||||
(def average-color
|
||||
(pick))
|
||||
(convolve
|
||||
(sharpen))
|
Loading…
x
Reference in New Issue
Block a user