Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/web/www/routino/icons/create-icons.pl
Parent Directory
|
Revision Log
Revision 577 -
(hide annotations)
(download)
(as text)
Wed Dec 29 10:25:14 2010 UTC (14 years, 2 months ago) by amb
File MIME type: text/x-perl
File size: 4334 byte(s)
Wed Dec 29 10:25:14 2010 UTC (14 years, 2 months ago) by amb
File MIME type: text/x-perl
File size: 4334 byte(s)
Added the uncontrolled (not auto-generated) files from routino-1.4.
1 | amb | 569 | #!/usr/bin/perl |
2 | amb | 572 | # |
3 | # Routino icons Perl script | ||
4 | # | ||
5 | # Part of the Routino routing software. | ||
6 | # | ||
7 | amb | 577 | # This file Copyright 2008-2010 Andrew M. Bishop |
8 | amb | 572 | # |
9 | # This program is free software: you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU Affero General Public License as published by | ||
11 | # the Free Software Foundation, either version 3 of the License, or | ||
12 | # (at your option) any later version. | ||
13 | # | ||
14 | # This program is distributed in the hope that it will be useful, | ||
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | # GNU Affero General Public License for more details. | ||
18 | # | ||
19 | # You should have received a copy of the GNU Affero General Public License | ||
20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
21 | # | ||
22 | amb | 569 | |
23 | use Graphics::Magick; | ||
24 | |||
25 | # Markers for routing | ||
26 | |||
27 | amb | 572 | @names=("red","grey"); |
28 | @borders=("black","grey"); | ||
29 | @letters=("red","grey"); | ||
30 | |||
31 | amb | 577 | foreach $character ('0'..'9','home') |
32 | amb | 569 | { |
33 | amb | 572 | foreach $colour (0..$#names) |
34 | { | ||
35 | $image=Graphics::Magick->new; | ||
36 | $image->Set(size => "63x75"); | ||
37 | amb | 569 | |
38 | amb | 577 | $image->ReadImage('xc:white'); |
39 | $image->Transparent('white'); | ||
40 | amb | 569 | |
41 | amb | 572 | $image->Draw(primitive => polygon, points => '1,32 32,73 61,32 32,10', |
42 | stroke => $borders[$colour], fill => 'white', strokewidth => 6, | ||
43 | amb | 574 | antialias => 'false'); |
44 | amb | 569 | |
45 | amb | 572 | $image->Draw(primitive => arc, points => '1,1 61,61 -180,0', |
46 | stroke => $borders[$colour], fill => 'white', strokewidth => 6, | ||
47 | amb | 574 | antialias => 'false'); |
48 | amb | 569 | |
49 | amb | 577 | if($character eq 'home') |
50 | { | ||
51 | $home=Graphics::Magick->new; | ||
52 | amb | 569 | |
53 | amb | 577 | $home->ReadImage("home.png"); |
54 | amb | 569 | |
55 | amb | 577 | $home->Opaque(fill => $names[$colour], color => 'black'); |
56 | |||
57 | $image->Composite(image => $home, compose => Over, | ||
58 | x => 32-$home->Get('width')/2, y => 26-$home->Get('height')/2); | ||
59 | } | ||
60 | else | ||
61 | { | ||
62 | ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = | ||
63 | $image->QueryFontMetrics(text => $character, font => 'Helvetica', pointsize => '36'); | ||
64 | |||
65 | $image->Annotate(text => $character, font => 'Helvetica', pointsize => '36', | ||
66 | stroke => $letters[$colour], fill => $letters[$colour], | ||
67 | x => 32, y => 32-$descender, align => Center, | ||
68 | antialias => 'false'); | ||
69 | } | ||
70 | |||
71 | amb | 572 | $image->Resize(width => 21, height => 25); |
72 | amb | 569 | |
73 | amb | 572 | $image->Write("marker-$character-$names[$colour].png"); |
74 | amb | 569 | |
75 | amb | 572 | undef $image; |
76 | } | ||
77 | amb | 569 | } |
78 | |||
79 | # Balls for visualiser descriptions | ||
80 | |||
81 | @colours=("#FFFFFF", | ||
82 | "#FF0000", | ||
83 | "#FFFF00", | ||
84 | "#00FF00", | ||
85 | "#8B4513", | ||
86 | "#00BFFF", | ||
87 | "#FF69B4", | ||
88 | "#000000", | ||
89 | "#000000", | ||
90 | "#000000"); | ||
91 | |||
92 | foreach $colour (0..9) | ||
93 | { | ||
94 | $image=Graphics::Magick->new; | ||
95 | $image->Set(size => "9x9"); | ||
96 | |||
97 | amb | 577 | $image->ReadImage('xc:white'); |
98 | $image->Transparent('white'); | ||
99 | amb | 569 | |
100 | $image->Draw(primitive => circle, points => '4,4 4,8', | ||
101 | fill => $colours[$colour], stroke => $colours[$colour], | ||
102 | amb | 574 | antialias => 'false'); |
103 | amb | 569 | |
104 | $image->Write("ball-$colour.png"); | ||
105 | |||
106 | undef $image; | ||
107 | } | ||
108 | |||
109 | # Limit signs | ||
110 | |||
111 | foreach $limit (1..160) | ||
112 | { | ||
113 | &draw_limit($limit); | ||
114 | } | ||
115 | |||
116 | foreach $limit (10..200) | ||
117 | { | ||
118 | &draw_limit(sprintf "%.1f",$limit/10); | ||
119 | } | ||
120 | |||
121 | &draw_limit("no"); | ||
122 | |||
123 | amb | 577 | unlink "limit-0.png"; |
124 | amb | 569 | link "limit-no.png","limit-0.png"; |
125 | |||
126 | amb | 577 | unlink "limit-0.0.png"; |
127 | link "limit-no.png","limit-0.0.png"; | ||
128 | |||
129 | amb | 569 | sub draw_limit |
130 | { | ||
131 | ($limit)=@_; | ||
132 | |||
133 | $image=Graphics::Magick->new; | ||
134 | $image->Set(size => "57x57"); | ||
135 | |||
136 | amb | 577 | $image->ReadImage('xc:white'); |
137 | $image->Transparent('white'); | ||
138 | amb | 569 | |
139 | $image->Draw(primitive => circle, points => '28,28 28,55', | ||
140 | stroke => 'red', fill => 'white', strokewidth => 3, | ||
141 | amb | 574 | antialias => 'false'); |
142 | amb | 569 | |
143 | amb | 574 | ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = |
144 | $image->QueryFontMetrics(text => "$limit", font => 'Helvetica', pointsize => '22'); | ||
145 | amb | 569 | |
146 | $image->Annotate(text => "$limit", font => 'Helvetica', pointsize => '22', | ||
147 | amb | 574 | stroke => 'black', fill => 'black', |
148 | x => 28, y => 28-$descender, align => Center, | ||
149 | antialias => 'false'); | ||
150 | amb | 569 | |
151 | $image->Resize(width => 19, height => 19); | ||
152 | |||
153 | $image->Write("limit-$limit.png"); | ||
154 | |||
155 | undef $image; | ||
156 | } |
Properties
Name | Value |
---|---|
svn:executable | * |