1 ;;;; $Id: illustrations.lisp,v 1.6 2007/10/01 16:24:10 xach Exp $
3 (defpackage #:vecto-illustrations
6 (in-package #:vecto-illustrations
)
14 (defun annotated-path (&rest points
)
16 (set-rgb-stroke 0.5 0.5 0.5)
17 (set-rgb-fill 0.5 0.5 0.5)
19 (dolist (point (remove-duplicates points
:test
'equal
))
20 (centered-circle-path (x point
) (y point
) 3))
22 (move-to (x (first points
)) (y (first points
)))
23 (dolist (point (rest points
))
24 (line-to (x point
) (y point
)))
28 (defun join-style (style file
)
29 (with-canvas (:width
160 :height
165)
32 (set-rgb-stroke 0 0 0)
39 (annotated-path '(20 .
20)
45 (defun cap-style (style file
)
46 (with-canvas (:width
40 :height
100)
49 (set-rgb-stroke 0 0 0)
55 (annotated-path '(20 .
20) '(20 .
80))
60 (defun closed-subpaths (closep file
)
61 (with-canvas (:width
160 :height
160)
64 (set-rgb-stroke 0 0 0)
74 (annotated-path '(20 .
20)
81 (defun dash-paths (array phase cap-style file
)
82 (with-canvas (:width
160 :height
40)
85 (set-rgb-stroke 0 0 0)
88 (set-dash-pattern array phase
)
89 (set-line-cap cap-style
)
93 (annotated-path '(20 .
20) '(140 .
20))
97 (defun simple-clipping-path (file &key clip-circle clip-rounded-rectangle
)
98 (with-canvas (:width
100 :height
100)
105 (set-rgb-fill 0.9 0.9 0.9)
106 (rectangle 10 10 80 80)
110 (centered-circle-path x0 y r
)
113 (when clip-rounded-rectangle
114 (rounded-rectangle 45 25 50 50 10 10)
118 (set-rgb-stroke 1 1 0)
119 (rectangle 10 10 80 80)
123 (set-rgb-stroke 0.5 0.5 0.5)
124 (set-dash-pattern #(5) 0)
126 (centered-circle-path x0 y r
)
128 (when clip-rounded-rectangle
130 (set-rgb-stroke 0.5 0.5 0.5)
131 (set-dash-pattern #(5) 0)
133 (rounded-rectangle 45 25 50 50 10 10)
138 (defun make-illustrations ()
139 (cap-style :butt
"cap-style-butt.png")
140 (cap-style :square
"cap-style-square.png")
141 (cap-style :round
"cap-style-round.png")
142 (join-style :miter
"join-style-miter.png")
143 (join-style :bevel
"join-style-bevel.png")
144 (join-style :round
"join-style-round.png")
145 (closed-subpaths nil
"open-subpath.png")
146 (closed-subpaths t
"closed-subpath.png")
147 (dash-paths #() 0 :butt
"dash-pattern-none.png")
148 (dash-paths #(30 30) 0 :butt
"dash-pattern-a.png")
149 (dash-paths #(30 30) 15 :butt
"dash-pattern-b.png")
150 (dash-paths #(10 20 10 40) 0 :butt
"dash-pattern-c.png")
151 (dash-paths #(10 20 10 40) 13 :butt
"dash-pattern-d.png")
152 (dash-paths #(30 30) 0 :round
"dash-pattern-e.png")
153 (simple-clipping-path "clip-unclipped.png")
154 (simple-clipping-path "clip-to-circle.png" :clip-circle t
)
155 (simple-clipping-path "clip-to-rectangle.png" :clip-rounded-rectangle t
)
156 (simple-clipping-path "clip-to-both.png"
158 :clip-rounded-rectangle t
))