transfer image data

This commit is contained in:
David Botton 2022-08-22 00:40:39 -04:00
parent 74be9b9911
commit 42a5efd09d
3 changed files with 322 additions and 35 deletions

View file

@ -6,9 +6,11 @@
;;; A very brief example of using the canvas control.
(defun on-new-window (body)
(debug-mode body)
(setf (title (html-document body)) "Tutorial 10")
(let* ((canvas (create-canvas body :width 600 :height 400))
(cx (create-context2d canvas)))
(cx (create-context2d canvas))
dat)
(set-border canvas :thin :solid :black)
(setf (fill-style cx) :green)
(fill-rect cx 10 10 150 100)
@ -19,7 +21,13 @@
(begin-path cx)
(ellipse cx 200 200 50 7 0.78 0 6.29)
(path-stroke cx)
(path-fill cx)))
(path-fill cx)
(setf dat (get-image-data cx 100 100 10 10))
(put-image-data cx dat 10 200)
(let ((data (json-image-data dat)))
(setf data (ppcre:regex-replace-all ":0" data ":255"))
(setf (json-image-data dat) data))
(put-image-data cx dat 30 200)))
(defun start-tutorial ()
"Start turtorial."