<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
#
# Routino icons Perl script
#
# Part of the Routino routing software.
#
# This file Copyright 2008,2009 Andrew M. Bishop
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
#

use Graphics::Magick;

# Markers for routing

@names=("red","grey");
@borders=("black","grey");
@letters=("red","grey");

foreach $character ('0'..'9')
  {
   foreach $colour (0..$#names)
     {
      $image=Graphics::Magick-&gt;new;
      $image-&gt;Set(size =&gt; "63x75");

      $image-&gt;ReadImage('xc:transparent');

      $image-&gt;Draw(primitive =&gt; polygon, points =&gt; '1,32 32,73 61,32 32,10',
                   stroke =&gt; $borders[$colour], fill =&gt; 'white', strokewidth =&gt; 6,
                   antialias =&gt; false);

      $image-&gt;Draw(primitive =&gt; arc,     points =&gt; '1,1 61,61 -180,0',
                   stroke =&gt; $borders[$colour], fill =&gt; 'white', strokewidth =&gt; 6,
                   antialias =&gt; false);

      ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $image-&gt;QueryFontMetrics(text =&gt; $character);

      $image-&gt;Annotate(text =&gt; $character, font =&gt; 'Helvetica', pointsize =&gt; '36',
                       fill =&gt; $letters[$colour],
                       x =&gt; 32, y =&gt; 34+$y_ppem/2, align =&gt; Center,
                       antialias =&gt; false);

      $image-&gt;Resize(width =&gt; 21, height =&gt; 25);

      $image-&gt;Write("marker-$character-$names[$colour].png");

      undef $image;
     }
  }

# Balls for visualiser descriptions

@colours=("#FFFFFF",
          "#FF0000",
          "#FFFF00",
          "#00FF00",
          "#8B4513",
          "#00BFFF",
          "#FF69B4",
          "#000000",
          "#000000",
          "#000000");

foreach $colour (0..9)
  {
   $image=Graphics::Magick-&gt;new;
   $image-&gt;Set(size =&gt; "9x9");

   $image-&gt;ReadImage('xc:transparent');

   $image-&gt;Draw(primitive =&gt; circle, points =&gt; '4,4 4,8',
                fill =&gt; $colours[$colour], stroke =&gt; $colours[$colour],
                antialias =&gt; false);

   $image-&gt;Write("ball-$colour.png");

   undef $image;
  }

# Limit signs

foreach $limit (1..160)
  {
   &amp;draw_limit($limit);
  }

foreach $limit (10..200)
  {
   &amp;draw_limit(sprintf "%.1f",$limit/10);
  }

&amp;draw_limit("no");

link "limit-no.png","limit-0.png";

sub draw_limit
  {
   ($limit)=@_;

   $image=Graphics::Magick-&gt;new;
   $image-&gt;Set(size =&gt; "57x57");

   $image-&gt;ReadImage('xc:transparent');

   $image-&gt;Draw(primitive =&gt; circle, points =&gt; '28,28 28,55',
                stroke =&gt; 'red', fill =&gt; 'white', strokewidth =&gt; 3,
                antialias =&gt; false);

   ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $image-&gt;QueryFontMetrics(text =&gt; "$limit");

   $image-&gt;Annotate(text =&gt; "$limit", font =&gt; 'Helvetica', pointsize =&gt; '22',
                    fill =&gt; 'black',
                    x =&gt; 28, y =&gt; 28+$y_ppem/2, align =&gt; Center,
                    antialias =&gt; false);

   $image-&gt;Resize(width =&gt; 19, height =&gt; 19);

   $image-&gt;Write("limit-$limit.png");

   undef $image;
  }
</pre></body></html>