chiark / gitweb /
break out pscolour
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 13:03:56 +0000 (13:03 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 13:03:56 +0000 (13:03 +0000)
generate-board

index 54a565f661adf1f207466ae08e706b1cee997bce..76f3849e8425ff203af518282037e953a223f3fa 100755 (executable)
@@ -277,14 +277,20 @@ sub face_path ($) {
   o("    closepath\n");
 }
 
+sub pscolour ($) {
+  my ($spec) = @_;
+  confess unless defined $spec;
+  join ' ',
+      (map { sprintf "%.6f ", hex($_) / 15.0 }
+       split //, $spec),
+          'setrgbcolor';
+}
+
 sub fill_faces() {
   foreach my $rr (values %region) {
     next if $rr->{Name} eq 'L';
     face_path($rr);
-    my $chex = $c{Colours}{$rr->{Colour}};
-    next unless $chex;
-    o(sprintf " %.6f ", hex($_) / 15.0) foreach split //, $chex;
-    o(" setrgbcolor eofill\n");
+    o(" ", pscolour($c{Colours}{$rr->{Colour}}), " eofill\n");
   }
 }