chiark / gitweb /
break out facepath
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 12:58:33 +0000 (12:58 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 12:58:33 +0000 (12:58 +0000)
generate-board

index 5b7fa99a75a2968766d851643bcce8342d9676f8..dd1455e2f3465328e9f353a6f886a46be696213e 100755 (executable)
@@ -264,20 +264,25 @@ sub psvec ($) {
   sprintf "%20.6f %20.6f", $pos->get(0),$pos->get(1)
 }
 
+sub face_path ($) {
+  my ($rr) = @_;
+  o("% $rr->{Name}\n");
+  o("  newpath\n");
+  my $xto = 'moveto';
+  foreach my $vertex (@{ $rr->{Polygon} }) {
+    my $pos = $vertex->{Pos};
+    o(sprintf "    %s %s\n", psvec($pos), $xto);
+    $xto = 'lineto';
+  }
+  o("    closepath\n");
+}
+
 sub write_face_edges() {
   o("5 setlinewidth 1 setlinejoin\n");
   foreach my $rr (values %region) {
     next if $rr->{Name} eq 'L';
-    o("% $rr->{Name}\n");
-    o("  newpath\n");
-    my $xto = 'moveto';
+    face_path($rr);
     # xxx ordering: must do all fills then all strokes
-    foreach my $vertex (@{ $rr->{Polygon} }) {
-      my $pos = $vertex->{Pos};
-      o(sprintf "    %s %s\n", psvec($pos), $xto);
-      $xto = 'lineto';
-    }
-    o("    closepath\n");
     my $chex = $c{Colours}{$rr->{Colour}};
     if ($chex) {
       o("    gsave ");