3309269644e9 — Chris Cannam 2 years ago
First approximation
6 files changed, 95 insertions(+), 0 deletions(-)

A => .hgignore
A => Makefile
A => cover.mlb
A => cover.sml
A => cover.svg
A => main.sml
A => .hgignore +4 -0
@@ 0,0 1,4 @@ 
+syntax: glob
+*~
+cover
+*.deps

          
A => Makefile +18 -0
@@ 0,0 1,18 @@ 
+
+SCRIPTS		:= ../sml-buildscripts
+
+all:	cover.svg
+
+cover.svg:	cover
+	./$< > $@
+
+cover:	cover.mlb Makefile
+	${SCRIPTS}/polybuild $<
+
+clean:
+	rm -f cover
+
+%.deps:	%.mlb
+	${SCRIPTS}/mlb-dependencies $< > $@
+
+-include cover.deps

          
A => cover.mlb +3 -0
@@ 0,0 1,3 @@ 
+../sml-svg/svg.mlb
+cover.sml
+main.sml

          
A => cover.sml +52 -0
@@ 0,0 1,52 @@ 
+open Svg
+open SvgPathShorthand
+
+fun main () =
+    let val lens_radius = 31.6
+        val lens_centre_height = 31.9
+        val document =
+            { size = (200.0, 200.0),
+              content = [
+                  (GROUP [
+                        (RECT { origin = (0.0, 0.0),
+                                size = (160.0, 45.0) }, []),
+                        (CIRCLE { centre = (80.0, 22.5),
+                                  radius = 15.5 }, [])
+                    ],
+                   [STROKE (COLOUR "black"),
+                    STROKE_WIDTH 0.1,
+                    FILL NO_PAINT,
+                    TRANSFORM [TRANSLATE (20.0, 20.0)]
+                   ]),
+                  (GROUP [
+                        (CIRCLE { centre = (57.0 + lens_radius, 31.9),
+                                  radius = lens_radius }, []),
+                        (RECT { origin = (0.0, 12.0),
+                                size = (57.0 + 2.0 * lens_radius + 43.0,
+                                        43.0) }, []),
+                        (PATH [ M (57.0, lens_centre_height),
+                                L [(57.0 + lens_radius - 26.3, 0.0),
+                                   (57.0 + lens_radius + 26.3, 0.0),
+                                   (57.0 + 2.0 * lens_radius, lens_centre_height)] ], []),
+                        (CIRCLE { centre = (49.0, 12.0 + 15.0),
+                                  radius = 1.25 }, []),
+                        (CIRCLE { centre = (49.0, 12.0 + 43.0 - 13.0),
+                                  radius = 2.5 }, []),
+                        (RECT { origin = (57.0 + 2.0 * lens_radius + 43.0 - 3.5,
+                                          12.0 - 4.5),
+                                size = (3.5, 4.5) }, []),
+                        (RECT { origin = (57.0 + 2.0 * lens_radius + 43.0 - 3.5,
+                                          12.0 + 43.0),
+                                size = (3.5, 6.5) }, [])
+                    ],
+                   [STROKE (COLOUR "black"),
+                    STROKE_WIDTH 0.1,
+                    FILL NO_PAINT,
+                    TRANSFORM [TRANSLATE (20.0, 120.0)]
+                  ])
+              ]
+            }
+    in
+        print (SvgSerialise.serialiseDocumentAtScale 1.0 document)
+    end
+        

          
A => cover.svg +17 -0
@@ 0,0 1,17 @@ 
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200mm" height="200mm">
+<g transform="scale(3.77952755906,3.77952755906)">
+<g stroke="black" stroke-width="0.1" fill="none" transform="translate(20,20)"><rect x="0" y="0" width="160" height="45"/>
+<circle cx="80" cy="22.5" r="15.5"/>
+</g>
+<g stroke="black" stroke-width="0.1" fill="none" transform="translate(20,120)"><circle cx="88.6" cy="31.9" r="31.6"/>
+<rect x="0" y="12" width="163.2" height="43"/>
+<path d="M 57,31.9 L 62.3,0 114.9,0 120.2,31.9"/>
+<circle cx="49" cy="27" r="1.25"/>
+<circle cx="49" cy="42" r="2.5"/>
+<rect x="159.7" y="7.5" width="3.5" height="4.5"/>
+<rect x="159.7" y="55" width="3.5" height="6.5"/>
+</g>
+</g>
+</svg>

          
A => main.sml +1 -0
@@ 0,0 1,1 @@ 
+val () = main ()