<?xml version="1.0"?>
<paste-with-annotations>
  <paste>
    <number>
      <integer>49766</integer>
    </number>
    <user>
      <string>fax</string>
    </user>
    <title>
      <string>lisp svg examples</string>
    </title>
    <contents>
      <string>#||
&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; 
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;

&lt;svg width=&quot;5cm&quot; height=&quot;4cm&quot; version=&quot;1.1&quot;
     xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;desc&gt;Four separate rectangles
  &lt;/desc&gt;
    &lt;rect x=&quot;0.5cm&quot; y=&quot;0.5cm&quot; width=&quot;2cm&quot; height=&quot;1cm&quot;/&gt;
    &lt;rect x=&quot;0.5cm&quot; y=&quot;2cm&quot; width=&quot;1cm&quot; height=&quot;1.5cm&quot;/&gt;
    &lt;rect x=&quot;3cm&quot; y=&quot;0.5cm&quot; width=&quot;1.5cm&quot; height=&quot;2cm&quot;/&gt;
    &lt;rect x=&quot;3.5cm&quot; y=&quot;3cm&quot; width=&quot;1cm&quot; height=&quot;0.5cm&quot;/&gt;
  &lt;!-- Show outline of canvas using 'rect' element --&gt;
  &lt;rect x=&quot;.01cm&quot; y=&quot;.01cm&quot; width=&quot;4.98cm&quot; height=&quot;3.98cm&quot;
        fill=&quot;none&quot; stroke=&quot;blue&quot; stroke-width=&quot;.02cm&quot; /&gt;
&lt;/svg&gt;
||#

(defun test-1 ()
  (let ((svg (make-svg :width 5 :height 4 :version &quot;1.1&quot; :xmlns &quot;http://www.w3.org/2000/svg&quot;)))
    (add-element svg (make-rect :x 0.5 :y 0.5 :width 2 :height 1))
    (add-element svg (make-rect :x 0.5 :y 2 :width 1 :height 1.5))
    (add-element svg (make-rect :x 3 :y 0.5 :width 1.5 :height 2))
    (add-element svg (make-rect :x 3.5 :y 3 :width 1 :height 0.5))
    ;; Show outline of canvas using 'rect' element
    (add-element svg (make-rect :x 0.1 :y 0.1 :width 4.98 :height 3.98
                                :fill &quot;none&quot; :stroke &quot;blue&quot; :stroke-width 0.2))
    (with-open-file (s &quot;/Users/ed/Desktop/test-1.svg&quot;
                       :direction :output
                       :if-exists :supersede
                       :if-does-not-exist :create)
      (print-svg svg s))))

#||
&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; 
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;
&lt;svg width=&quot;5cm&quot; height=&quot;5cm&quot; version=&quot;1.1&quot;
     xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;desc&gt;Two groups, each of two rectangles
  &lt;/desc&gt;
  &lt;g id=&quot;group1&quot; fill=&quot;red&quot; &gt;
    &lt;rect x=&quot;1cm&quot; y=&quot;1cm&quot; width=&quot;1cm&quot; height=&quot;1cm&quot; /&gt;
    &lt;rect x=&quot;3cm&quot; y=&quot;1cm&quot; width=&quot;1cm&quot; height=&quot;1cm&quot; /&gt;
  &lt;/g&gt;
  &lt;g id=&quot;group2&quot; fill=&quot;blue&quot; &gt;
    &lt;rect x=&quot;1cm&quot; y=&quot;3cm&quot; width=&quot;1cm&quot; height=&quot;1cm&quot; /&gt;
    &lt;rect x=&quot;3cm&quot; y=&quot;3cm&quot; width=&quot;1cm&quot; height=&quot;1cm&quot; /&gt;
  &lt;/g&gt;
  &lt;!-- Show outline of canvas using 'rect' element --&gt;
  &lt;rect x=&quot;.01cm&quot; y=&quot;.01cm&quot; width=&quot;4.98cm&quot; height=&quot;4.98cm&quot;
        fill=&quot;none&quot; stroke=&quot;blue&quot; stroke-width=&quot;.02cm&quot; /&gt;
&lt;/svg&gt;
||#

(defun test-2 ()
  (let ((svg (make-svg :width 5 :height 5 :version &quot;1.1&quot; :xmlns &quot;http://www.w3.org/2000/svg&quot;)))
    (add-element svg (make-desc &quot;Two groups, each of two rectangles&quot;))
    (let ((group-1 (make-group :id &quot;group1&quot; :fill &quot;red&quot;)))
      (add-element group-1 (make-rect :x 1 :y 1 :width 1 :height 1))
      (add-element group-1 (make-rect :x 3 :y 1 :width 1 :height 1))
      (add-element svg group-1))
    (let ((group-2 (make-group :id &quot;group1&quot; :fill &quot;blue&quot;)))
      (add-element group-2 (make-rect :x 1 :y 3 :width 1 :height 1))
      (add-element group-2 (make-rect :x 3 :y 3 :width 1 :height 1))
      (add-element svg group-2))
    ;; Show outline of canvas using 'rect' element
    (add-element svg (make-rect :x 0.1 :y 0.1 :width 4.98 :height 4.98
                                :fill &quot;none&quot; :stroke &quot;blue&quot; :stroke-width 0.02))
    (with-open-file (s &quot;/Users/ed/Desktop/test-2.svg&quot;
                       :direction :output
                       :if-exists :supersede
                       :if-does-not-exist :create)
      (print-svg svg s))))

#||
&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; 
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;
&lt;svg width=&quot;10cm&quot; height=&quot;3cm&quot; viewBox=&quot;0 0 100 30&quot;
     xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;&gt;
  &lt;desc&gt;Example Use03-GeneratedContent - 'use' with a 'transform' attribute&lt;/desc&gt;
  &lt;!-- 'defs' section left out --&gt;
  &lt;rect x=&quot;.1&quot; y=&quot;.1&quot; width=&quot;99.8&quot; height=&quot;29.8&quot;
        fill=&quot;none&quot; stroke=&quot;blue&quot; stroke-width=&quot;.2&quot; /&gt;
  &lt;!-- Start of generated content. Replaces 'use' --&gt;
  &lt;g transform=&quot;translate(20,2.5) rotate(10)&quot;&gt;
    &lt;rect x=&quot;0&quot; y=&quot;0&quot; width=&quot;60&quot; height=&quot;10&quot;/&gt;
  &lt;/g&gt;
  &lt;!-- End of generated content --&gt;
&lt;/svg&gt;
||#

(defun test-3 ()
  (let ((svg (make-svg :width 10 :height 3 :|viewBox| &quot;0 0 100 30&quot;
                       :version &quot;1.1&quot; :xmlns &quot;http://www.w3.org/2000/svg&quot;)))
    (let ((group (make-group :transform &quot;translate(20,2.5) rotate(10)&quot;)))
      (add-element group (make-rect :x 0 :y 0 :width 60 :height 10))
      (add-element svg group))
    ;; Show outline of canvas using 'rect' element
    (add-element svg (make-rect :x 0.1 :y 0.1 :width 99.8 :height 29.8
                                :fill &quot;none&quot; :stroke &quot;blue&quot; :stroke-width 0.02))
    (with-open-file (s &quot;/Users/ed/Desktop/test-3.svg&quot;
                       :direction :output
                       :if-exists :supersede
                       :if-does-not-exist :create)
      (print-svg svg s))))


#||
&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; 
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;

&lt;svg width=&quot;5cm&quot; height=&quot;4cm&quot; viewBox=&quot;0 0 500 400&quot;
     xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;&gt;
  &lt;title&gt;Example cubic01- cubic Bezier commands in path data&lt;/title&gt;
  &lt;desc&gt;Picture showing a simple example of path data
        using both a &quot;C&quot; and an &quot;S&quot; command,
        along with annotations showing the control points
        and end points&lt;/desc&gt;
  &lt;style type=&quot;text/css&quot;&gt;&lt;![CDATA[
    .Border { fill:none; stroke:blue; stroke-width:1 }
    .Connect { fill:none; stroke:#888888; stroke-width:2 }
    .SamplePath { fill:none; stroke:red; stroke-width:5 }
    .EndPoint { fill:none; stroke:#888888; stroke-width:2 }
    .CtlPoint { fill:#888888; stroke:none }
    .AutoCtlPoint { fill:none; stroke:blue; stroke-width:4 }
    .Label { font-size:22; font-family:Verdana }
  ]]&gt;&lt;/style&gt;
  &lt;rect class=&quot;Border&quot; x=&quot;1&quot; y=&quot;1&quot; width=&quot;498&quot; height=&quot;398&quot; /&gt;
  &lt;polyline class=&quot;Connect&quot; points=&quot;100,200 100,100&quot; /&gt;
  &lt;polyline class=&quot;Connect&quot; points=&quot;250,100 250,200&quot; /&gt;
  &lt;polyline class=&quot;Connect&quot; points=&quot;250,200 250,300&quot; /&gt;
  &lt;polyline class=&quot;Connect&quot; points=&quot;400,300 400,200&quot; /&gt;
  &lt;path class=&quot;SamplePath&quot; d=&quot;M100,200 C100,100 250,100 250,200
                                       S400,300 400,200&quot; /&gt;
  &lt;circle class=&quot;EndPoint&quot; cx=&quot;100&quot; cy=&quot;200&quot; r=&quot;10&quot; /&gt;
  &lt;circle class=&quot;EndPoint&quot; cx=&quot;250&quot; cy=&quot;200&quot; r=&quot;10&quot; /&gt;
  &lt;circle class=&quot;EndPoint&quot; cx=&quot;400&quot; cy=&quot;200&quot; r=&quot;10&quot; /&gt;
  &lt;circle class=&quot;CtlPoint&quot; cx=&quot;100&quot; cy=&quot;100&quot; r=&quot;10&quot; /&gt;
  &lt;circle class=&quot;CtlPoint&quot; cx=&quot;250&quot; cy=&quot;100&quot; r=&quot;10&quot; /&gt;
  &lt;circle class=&quot;CtlPoint&quot; cx=&quot;400&quot; cy=&quot;300&quot; r=&quot;10&quot; /&gt;
  &lt;circle class=&quot;AutoCtlPoint&quot; cx=&quot;250&quot; cy=&quot;300&quot; r=&quot;9&quot; /&gt;
  &lt;text class=&quot;Label&quot; x=&quot;25&quot; y=&quot;70&quot;&gt;M100,200 C100,100 250,100 250,200&lt;/text&gt;
  &lt;text class=&quot;Label&quot; x=&quot;325&quot; y=&quot;350&quot;
        style=&quot;text-anchor:middle&quot;&gt;S400,300 400,200&lt;/text&gt;
&lt;/svg&gt;
||#

(defun test-4 ()
  (let ((svg (make-svg :width 5 :height 4 :|viewBox| &quot;0 0 500 400&quot;
                       :version &quot;1.1&quot; :xmlns &quot;http://www.w3.org/2000/svg&quot;)))
    (add-element svg (make-css &quot;
.Border { fill:none; stroke:blue; stroke-width:1 }
.Connect { fill:none; stroke:#888888; stroke-width:2 }
.SamplePath { fill:none; stroke:red; stroke-width:5 }
.EndPoint { fill:none; stroke:#888888; stroke-width:2 }
.CtlPoint { fill:#888888; stroke:none }
.AutoCtlPoint { fill:none; stroke:blue; stroke-width:4 }
.Label { font-size:22; font-family:Verdana }&quot;))
    ;; Show outline of canvas using 'rect' element
    (add-element svg (make-rect :class &quot;Border&quot; :x &quot;1&quot; :y &quot;1&quot; :width &quot;498&quot; :height &quot;398&quot;))
    (add-element svg (make-polyline :class &quot;Connect&quot; :points &quot;100,200 100,100&quot;))
    (add-element svg (make-polyline :class &quot;Connect&quot; :points &quot;250,100 250,200&quot;))
    (add-element svg (make-polyline :class &quot;Connect&quot; :points &quot;250,200 250,300&quot;))
    (add-element svg (make-polyline :class &quot;Connect&quot; :points &quot;400,300 400,200&quot;))
    (add-element svg (make-path :class &quot;SamplePath&quot; :d &quot;M100,200 C100,100 250,100 250,200 S400,300 400,200&quot;))
    (add-element svg (make-circle :class &quot;EndPoint&quot; :cx &quot;100&quot; :cy &quot;200&quot; :r &quot;10&quot;))
    (add-element svg (make-circle :class &quot;EndPoint&quot; :cx &quot;250&quot; :cy &quot;200&quot; :r &quot;10&quot;))
    (add-element svg (make-circle :class &quot;EndPoint&quot; :cx &quot;400&quot; :cy &quot;200&quot; :r &quot;10&quot;))
    (add-element svg (make-circle :class &quot;CtlPoint&quot; :cx &quot;100&quot; :cy &quot;100&quot; :r &quot;10&quot;))
    (add-element svg (make-circle :class &quot;CtlPoint&quot; :cx &quot;250&quot; :cy &quot;100&quot; :r &quot;10&quot;))
    (add-element svg (make-circle :class &quot;CtlPoint&quot; :cx &quot;400&quot; :cy &quot;300&quot; :r &quot;10&quot;))
    (add-element svg (make-circle :class &quot;AutoCtlPoint&quot; :cx &quot;250&quot; :cy &quot;300&quot; :r &quot;9&quot;))
    (add-element svg (make-text &quot;M100,200 C100,100 250,100 250,200&quot;
                                :class &quot;Label&quot; :x &quot;25&quot; :y &quot;70&quot;))
    (add-element svg (make-text &quot;S400,300 400,200&quot;
                                :class &quot;Label&quot; :style &quot;text-anchor:middle&quot; :x &quot;325&quot; :y &quot;350&quot;))
    (with-open-file (s &quot;/Users/ed/Desktop/test-4.svg&quot;
                       :direction :output
                       :if-exists :supersede
                       :if-does-not-exist :create)
      (print-svg svg s))))

#||
&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; 
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;
&lt;svg width=&quot;12cm&quot; height=&quot;4cm&quot; viewBox=&quot;0 0 1200 400&quot;
     xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;&gt;
  &lt;desc&gt;Example rect02 - rounded rectangles&lt;/desc&gt;
  &lt;!-- Show outline of canvas using 'rect' element --&gt;
  &lt;rect x=&quot;1&quot; y=&quot;1&quot; width=&quot;1198&quot; height=&quot;398&quot;
        fill=&quot;none&quot; stroke=&quot;blue&quot; stroke-width=&quot;2&quot;/&gt;
  &lt;rect x=&quot;100&quot; y=&quot;100&quot; width=&quot;400&quot; height=&quot;200&quot; rx=&quot;50&quot;
        fill=&quot;green&quot; /&gt;
  &lt;g transform=&quot;translate(700 210) rotate(-30)&quot;&gt;
    &lt;rect x=&quot;0&quot; y=&quot;0&quot; width=&quot;400&quot; height=&quot;200&quot; rx=&quot;50&quot;
          fill=&quot;none&quot; stroke=&quot;purple&quot; stroke-width=&quot;30&quot; /&gt;
  &lt;/g&gt;
&lt;/svg&gt;
||#

(defun test-5 ()
  (let ((svg (make-svg :width 12 :height 4 :|viewBox| &quot;0 0 1200 400&quot;
                       :version &quot;1.1&quot; :xmlns &quot;http://www.w3.org/2000/svg&quot;)))
    (add-element svg (make-desc &quot;Example rect02 - rounded rectangles&quot;))
    (add-element svg (make-rect :x &quot;1&quot; :y &quot;1&quot; :width &quot;1198&quot; :height &quot;398&quot;
                                :fill &quot;none&quot; :stroke &quot;blue&quot; :stroke-width &quot;2&quot;))
    (add-element svg (make-rect :x &quot;100&quot; :y &quot;100&quot; :width &quot;400&quot; :height &quot;200&quot; :rx &quot;50&quot;
                                :fill &quot;green&quot;))
    (let ((group (make-group :transform &quot;translate(700 210) rotate(-30)&quot;)))
      (add-element group (make-rect :x &quot;0&quot; :y &quot;0&quot; :width &quot;400&quot; :height &quot;200&quot; :rx &quot;50&quot;
                                    :fill &quot;none&quot; :stroke &quot;purple&quot; :stroke-width &quot;30&quot;))
      (add-element svg group))
    (with-open-file (s &quot;/Users/ed/Desktop/test-5.svg&quot;
                       :direction :output
                       :if-exists :supersede
                       :if-does-not-exist :create)
      (print-svg svg s))))

#||
&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; 
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;
&lt;svg width=&quot;10cm&quot; height=&quot;3cm&quot; viewBox=&quot;0 0 1000 300&quot;
     xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;&gt;
  &lt;desc&gt;Example tspan01 - using tspan to change visual attributes&lt;/desc&gt;
  &lt;g font-family=&quot;Verdana&quot; font-size=&quot;45&quot; &gt;
    &lt;text x=&quot;200&quot; y=&quot;150&quot; fill=&quot;blue&quot; &gt;
      You are
        &lt;tspan font-weight=&quot;bold&quot; fill=&quot;red&quot; &gt;not&lt;/tspan&gt;
      a banana.
    &lt;/text&gt;
  &lt;/g&gt;
  &lt;!-- Show outline of canvas using 'rect' element --&gt;
  &lt;rect x=&quot;1&quot; y=&quot;1&quot; width=&quot;998&quot; height=&quot;298&quot;
        fill=&quot;none&quot; stroke=&quot;blue&quot; stroke-width=&quot;2&quot; /&gt;
&lt;/svg&gt;
||#

(defun test-6 ()
  (let ((svg (make-svg :width 10 :height 3 :|viewBox| &quot;0 0 1000 300&quot;
                       :version &quot;1.1&quot; :xmlns &quot;http://www.w3.org/2000/svg&quot;)))
    (let ((group (make-group :font-family &quot;Verdana&quot; :font-size &quot;45&quot;)))
      (let ((text (make-text &quot;You are &quot; :x &quot;200&quot; :y &quot;150&quot; :fill &quot;blue&quot;)))
        (add-element text (make-tspan &quot;not&quot; :font-weight &quot;bold&quot; :fill &quot;red&quot;))
        (add-element text &quot; a banana.&quot;)
        (add-element group text))
      (add-element svg group))
    (with-open-file (s &quot;/Users/ed/Desktop/test-6.svg&quot;
                       :direction :output
                       :if-exists :supersede
                       :if-does-not-exist :create)
      (print-svg svg s))))

#||
&lt;?xml version=&quot;1.0&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; 
  &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;&gt;
&lt;svg width=&quot;10cm&quot; height=&quot;3cm&quot; viewBox=&quot;0 0 1000 300&quot;
     xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;&gt;
  &lt;desc&gt;Example tspan03 - using tspan's x and y attributes 
        for multiline text and precise glyph positioning&lt;/desc&gt;
  &lt;g font-family=&quot;Verdana&quot; font-size=&quot;45&quot; &gt;
    &lt;text fill=&quot;rgb(255,164,0)&quot; &gt;
      &lt;tspan x=&quot;300 350 400 450 500 550 600 650&quot; y=&quot;100&quot;&gt;
        Cute and
      &lt;/tspan&gt;
      &lt;tspan x=&quot;375 425 475 525 575&quot; y=&quot;200&quot;&gt;
         fuzzy
      &lt;/tspan&gt;
    &lt;/text&gt;
  &lt;/g&gt;
  &lt;!-- Show outline of canvas using 'rect' element --&gt;
  &lt;rect x=&quot;1&quot; y=&quot;1&quot; width=&quot;998&quot; height=&quot;298&quot;
        fill=&quot;none&quot; stroke=&quot;blue&quot; stroke-width=&quot;2&quot; /&gt;
&lt;/svg&gt;
||#

(defun test-7 ()
  (let ((svg (make-svg :width 10 :height 3 :|viewBox| &quot;0 0 1000 300&quot;
                       :version &quot;1.1&quot; :xmlns &quot;http://www.w3.org/2000/svg&quot;)))
    (let ((group (make-group :font-family &quot;Verdana&quot; :font-size &quot;45&quot;)))
      (let ((text (make-text () :fill &quot;rgb(255,164,0)&quot;)))
        (add-element text (make-tspan &quot;Cute and &quot; :x &quot;300 350 400 450 500 550 600 650&quot; :y &quot;100&quot;))
        (add-element text (make-tspan &quot; fuzzy&quot; :x &quot;375 425 475 525 575&quot; :y &quot;200&quot;))
        (add-element group text))
      (add-element svg group))
    (with-open-file (s &quot;/Users/ed/Desktop/test-7.svg&quot;
                       :direction :output
                       :if-exists :supersede
                       :if-does-not-exist :create)
      (print-svg svg s))))
</string>
    </contents>
    <universal-time>
      <integer>3402239415</integer>
    </universal-time>
    <channel>
      <string>#lispcafe</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <null/>
    </is-unicode>
  </paste>
</paste-with-annotations>