Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/web/www/routino/icons/create-icons.pl
Parent Directory
|
Revision Log
Revision 1030 -
(show annotations)
(download)
(as text)
Tue Jul 31 18:57:50 2012 UTC (12 years, 7 months ago) by amb
File MIME type: text/x-perl
File size: 5444 byte(s)
Tue Jul 31 18:57:50 2012 UTC (12 years, 7 months ago) by amb
File MIME type: text/x-perl
File size: 5444 byte(s)
Create more limit markers for the visualiser.
1 | #!/usr/bin/perl |
2 | # |
3 | # Routino icons Perl script |
4 | # |
5 | # Part of the Routino routing software. |
6 | # |
7 | # This file Copyright 2008-2012 Andrew M. Bishop |
8 | # |
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 | |
23 | use Graphics::Magick; |
24 | |
25 | # Markers for routing |
26 | |
27 | @names=("red","grey"); |
28 | @borders=("black","grey"); |
29 | @letters=("red","grey"); |
30 | |
31 | foreach $character (1..99,'home','XXX') |
32 | { |
33 | foreach $colour (0..$#names) |
34 | { |
35 | $image=Graphics::Magick->new; |
36 | $image->Set(size => "63x75"); |
37 | |
38 | $image->ReadImage('xc:white'); |
39 | $image->Transparent('white'); |
40 | |
41 | $image->Draw(primitive => polygon, points => '1,32 32,73 61,32 32,10', |
42 | stroke => $borders[$colour], fill => 'white', strokewidth => 6, |
43 | antialias => 'false'); |
44 | |
45 | $image->Draw(primitive => arc, points => '1,1 61,61 -180,0', |
46 | stroke => $borders[$colour], fill => 'white', strokewidth => 6, |
47 | antialias => 'false'); |
48 | |
49 | if($character eq 'home') |
50 | { |
51 | $home=Graphics::Magick->new; |
52 | |
53 | $home->ReadImage("home.png"); |
54 | |
55 | $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 | elsif($character eq 'XXX') |
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 => "X", font => 'Helvetica', pointsize => '36', |
66 | stroke => $letters[$colour], fill => $letters[$colour], |
67 | x => 32, y => 32-$descender, align => Center, |
68 | antialias => 'false'); |
69 | } |
70 | elsif($character>=0 && $character<=9) |
71 | { |
72 | ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = |
73 | $image->QueryFontMetrics(text => $character, font => 'Helvetica', pointsize => '36'); |
74 | |
75 | $image->Annotate(text => $character, font => 'Helvetica', pointsize => '36', |
76 | stroke => $letters[$colour], fill => $letters[$colour], |
77 | x => 32, y => 32-$descender, align => Center, |
78 | antialias => 'false'); |
79 | } |
80 | else |
81 | { |
82 | ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = |
83 | $image->QueryFontMetrics(text => $character, font => 'Helvetica', pointsize => '32'); |
84 | |
85 | $image->Annotate(text => $character, font => 'Helvetica', pointsize => '32', |
86 | stroke => $letters[$colour], fill => $letters[$colour], |
87 | x => 32, y => 32-$descender, align => Center, |
88 | antialias => 'false'); |
89 | } |
90 | |
91 | $image->Resize(width => 21, height => 25); |
92 | |
93 | $image->Write("marker-$character-$names[$colour].png"); |
94 | |
95 | undef $image; |
96 | } |
97 | } |
98 | |
99 | # Balls for visualiser descriptions |
100 | |
101 | @colours=("#FFFFFF", |
102 | "#FF0000", |
103 | "#FFFF00", |
104 | "#00FF00", |
105 | "#8B4513", |
106 | "#00BFFF", |
107 | "#FF69B4", |
108 | "#000000", |
109 | "#000000", |
110 | "#000000"); |
111 | |
112 | foreach $colour (0..9) |
113 | { |
114 | $image=Graphics::Magick->new; |
115 | $image->Set(size => "9x9"); |
116 | |
117 | $image->ReadImage('xc:white'); |
118 | $image->Transparent('white'); |
119 | |
120 | $image->Draw(primitive => circle, points => '4,4 4,8', |
121 | fill => $colours[$colour], stroke => $colours[$colour], |
122 | antialias => 'false'); |
123 | |
124 | $image->Write("ball-$colour.png"); |
125 | |
126 | undef $image; |
127 | } |
128 | |
129 | # Limit signs |
130 | |
131 | foreach $limit (1..200) |
132 | { |
133 | &draw_limit($limit); |
134 | } |
135 | |
136 | foreach $limit (1..400) |
137 | { |
138 | &draw_limit(sprintf "%.1f",$limit/10); |
139 | } |
140 | |
141 | &draw_limit("no"); |
142 | |
143 | unlink "limit-0.png"; |
144 | link "limit-no.png","limit-0.png"; |
145 | |
146 | unlink "limit-0.0.png"; |
147 | link "limit-no.png","limit-0.0.png"; |
148 | |
149 | sub draw_limit |
150 | { |
151 | ($limit)=@_; |
152 | |
153 | $image=Graphics::Magick->new; |
154 | $image->Set(size => "57x57"); |
155 | |
156 | $image->ReadImage('xc:white'); |
157 | $image->Transparent('white'); |
158 | |
159 | $image->Draw(primitive => circle, points => '28,28 28,55', |
160 | stroke => 'red', fill => 'white', strokewidth => 3, |
161 | antialias => 'false'); |
162 | |
163 | if($limit ne "no") |
164 | { |
165 | ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = |
166 | $image->QueryFontMetrics(text => "$limit", font => 'Helvetica', pointsize => '22'); |
167 | |
168 | $image->Annotate(text => "$limit", font => 'Helvetica', pointsize => '22', |
169 | stroke => 'black', fill => 'black', |
170 | x => 28, y => 28-$descender, align => Center, |
171 | antialias => 'false'); |
172 | } |
173 | |
174 | $image->Resize(width => 19, height => 19); |
175 | |
176 | $image->Write("limit-$limit.png"); |
177 | |
178 | undef $image; |
179 | } |
Properties
Name | Value |
---|---|
svn:executable | * |