--- a/flax.asd Fri Mar 23 19:18:28 2018 -0400
+++ b/flax.asd Fri Mar 23 19:28:05 2018 -0400
@@ -32,7 +32,8 @@
(:module "drawing" :serial t
:components ((:file "api")
(:file "png")
- (:file "svg")))
+ (:file "svg")
+ (:file "plot")))
(:module "looms" :serial nil
:components
((:file "001-triangles")
--- a/src/drawing/api.lisp Fri Mar 23 19:18:28 2018 -0400
+++ b/src/drawing/api.lisp Fri Mar 23 19:28:05 2018 -0400
@@ -183,9 +183,16 @@
(defgeneric write-file (canvas filename))
+;;;; File Extensions ----------------------------------------------------------
+(defgeneric file-extension (type))
+
+(defmethod file-extension (type)
+ (string-downcase (symbol-name type)))
+
+
;;;; Toplevel -----------------------------------------------------------------
(defun full-filename (filename canvas-type)
- (format nil "~A.~A" filename (string-downcase (symbol-name canvas-type))))
+ (format nil "~A.~A" filename (file-extension canvas-type)))
(defmacro with-rendering
((canvas-symbol canvas-type filename width height &key
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/drawing/plot.lisp Fri Mar 23 19:28:05 2018 -0400
@@ -0,0 +1,18 @@
+(in-package :flax.drawing)
+
+;;; A plot is an SVG without the square background.
+;;; TODO: shell out to svgsort automatically?
+
+
+(defclass* (plot-canvas :conc-name "") (svg-canvas) ())
+
+(defmethod make-canvas ((type (eql :plot)) &key height width)
+ (let ((scene (svg:make-svg-toplevel 'svg:svg-1.1-toplevel
+ :height height :width width)))
+ (make-instance 'plot-canvas
+ :height height
+ :width width
+ :scene scene)))
+
+(defmethod file-extension ((type (eql :plot)))
+ "svg")
--- a/src/looms/004-turtle-curves.lisp Fri Mar 23 19:18:28 2018 -0400
+++ b/src/looms/004-turtle-curves.lisp Fri Mar 23 19:28:05 2018 -0400
@@ -314,9 +314,9 @@
-;; (time (loom 12 "out" :svg 800 800
+;; (time (loom 12 "out" :plot 800 800
;; ;; :l-system *hexagonal-gosper-curve*
-;; ;; :iterations 5
+;; :iterations 5
;; ;; :starting-angle (- 1/4tau)
;; ))