|
| 1 | +#!/usr/bin/perl -w |
| 2 | + |
| 3 | +$TARGET_DIR = "../android/res/"; |
| 4 | +$TEMP_DIR = "../icons_temp/"; |
| 5 | + |
| 6 | +# dpi: 120 160 240 320 480 640 |
| 7 | +my %ic_smaller_sizes = (ldpi=>20, mdpi=>24, hdpi=>32, xhdpi=>48, xxhdpi=>64, xxxhdpi=>96); |
| 8 | +my %ic_actions_sizes = (ldpi=>24, mdpi=>32, hdpi=>48, xhdpi=>64, xxhdpi=>96, xxxhdpi=>128); |
| 9 | +my %ic_menu_sizes = (ldpi=>36, mdpi=>48, hdpi=>72, xhdpi=>96, xxhdpi=>144, xxxhdpi=>192); |
| 10 | +my %ic_launcher_sizes = (ldpi=>36, mdpi=>48, hdpi=>72, xhdpi=>96, xxhdpi=>144, xxxhdpi=>192); |
| 11 | +my %ic_bigicons_sizes = (ldpi=>36, mdpi=>48, hdpi=>72, xhdpi=>96, xxhdpi=>144, xxxhdpi=>192); |
| 12 | + |
| 13 | +my %ic_smaller_list=( |
| 14 | + 'icons8_cancel.svg' => 'icons8_cancel_small.png', |
| 15 | + 'icons8_ask_question.svg' => 'icons8_ask_question.png', |
| 16 | + 'icons8_back_small.svg' => 'icons8_back_small.png', |
| 17 | + 'icons8_forward_small.svg' => 'icons8_forward_small.png', |
| 18 | + 'icons8_drop_down_no_frame.svg' => 'icons8_drop_down_no_frame_small.png', |
| 19 | + 'icons8_drop_up_no_frame.svg' => 'icons8_drop_up_no_frame_small.png', |
| 20 | + 'icons8_scroll_down.svg' => 'icons8_scroll_down_small.png', |
| 21 | + 'icons8_scroll_up.svg' => 'icons8_scroll_up_small.png', |
| 22 | + 'icons8_freq_down.svg' => 'icons8_freq_down.png', |
| 23 | + 'icons8_freq_up.svg' => 'icons8_freq_up.png', |
| 24 | + 'icons8_rate_down.svg' => 'icons8_rate_down.png', |
| 25 | + 'icons8_rate_up.svg' => 'icons8_rate_up.png', |
| 26 | + 'icons8_volume_down.svg' => 'icons8_volume_down.png', |
| 27 | + 'icons8_volume_up.svg' => 'icons8_volume_up.png', |
| 28 | + 'icons8_star.svg' => 'icons8_fav_star.png', |
| 29 | + 'icons8_star_filled.svg' => 'icons8_fav_star_filled.png' |
| 30 | +); |
| 31 | + |
| 32 | +my %ic_actions_list=( |
| 33 | + 'icons8_play_ell.svg' => 'icons8_play_ell.png' |
| 34 | +); |
| 35 | + |
| 36 | +my %ic_menu_list=( |
| 37 | + 'icons8_css.svg' => 'icons8_css.png', |
| 38 | + 'icons8_page.svg' => 'icons8_page.png', |
| 39 | + 'icons8_one_finger.svg' => 'icons8_one_finger.png', |
| 40 | + 'icons8_settings.svg' => 'icons8_settings.png', |
| 41 | + 'icons8_cursor.svg' => 'icons8_cursor.png', |
| 42 | + 'icons8_type_filled.svg' => 'icons8_type_filled.png', |
| 43 | + 'icons8_book.svg' => 'icons8_book_2.png', |
| 44 | + 'icons8_happy.svg' => 'icons8_happy.png', |
| 45 | + 'icons8_link.svg' => 'icons8_link.png', |
| 46 | + 'icons8_folder.svg' => 'icons8_folder_2.png', |
| 47 | + 'icons8_star.svg' => 'icons8_star.png' |
| 48 | + |
| 49 | +); |
| 50 | + |
| 51 | +my %ic_launcher_list=( |
| 52 | +); |
| 53 | + |
| 54 | +my %ic_bigicons_list=( |
| 55 | +); |
| 56 | + |
| 57 | +my ($srcfile, $dstfile); |
| 58 | +my ($dpi, $size); |
| 59 | +my $folder; |
| 60 | +my $resfile; |
| 61 | +my $cmd; |
| 62 | +my $ret; |
| 63 | + |
| 64 | +sub makeTemp { |
| 65 | + $src_file = $_[0]; |
| 66 | + $resfile = "${TEMP_DIR}/drk_${src_file}"; |
| 67 | + open(IN, '<'.$src_file) or die $src_file.':'.$!; |
| 68 | + open(OUT, '>'.$resfile) or die $resfile.':'.$!; |
| 69 | + while(<IN>) |
| 70 | + { |
| 71 | + $_ =~ s/808080/202020/g; |
| 72 | + print OUT $_; |
| 73 | + } |
| 74 | + close(IN); |
| 75 | + close(OUT); |
| 76 | + |
| 77 | + $resfile = "${TEMP_DIR}/lgt_${src_file}"; |
| 78 | + open(IN, '<'.$src_file) or die $src_file.':'.$!; |
| 79 | + open(OUT, '>'.$resfile) or die $resfile.':'.$!; |
| 80 | + while(<IN>) |
| 81 | + { |
| 82 | + $_ =~ s/808080/EEEEEE/g; |
| 83 | + print OUT $_; |
| 84 | + } |
| 85 | + close(IN); |
| 86 | + close(OUT); |
| 87 | + |
| 88 | + $resfile = "${TEMP_DIR}/wdrk_${src_file}"; |
| 89 | + open(IN, '<'.$src_file) or die $src_file.':'.$!; |
| 90 | + open(OUT, '>'.$resfile) or die $resfile.':'.$!; |
| 91 | + while(<IN>) |
| 92 | + { |
| 93 | + $_ =~ s/808080/65441a/g; |
| 94 | + print OUT $_; |
| 95 | + } |
| 96 | + close(IN); |
| 97 | + close(OUT); |
| 98 | + |
| 99 | + $resfile = "${TEMP_DIR}/wlgt_${src_file}"; |
| 100 | + open(IN, '<'.$src_file) or die $src_file.':'.$!; |
| 101 | + open(OUT, '>'.$resfile) or die $resfile.':'.$!; |
| 102 | + while(<IN>) |
| 103 | + { |
| 104 | + $_ =~ s/808080/efdbc2/g; |
| 105 | + print OUT $_; |
| 106 | + } |
| 107 | + close(IN); |
| 108 | + close(OUT); |
| 109 | +} |
| 110 | + |
| 111 | +# smaller icons |
| 112 | +while (($srcfile, $dstfile) = each(%ic_smaller_list)) |
| 113 | +{ |
| 114 | + makeTemp($srcfile); |
| 115 | + while (($dpi, $size) = each(%ic_smaller_sizes)) |
| 116 | + { |
| 117 | + $folder = "${TARGET_DIR}/drawable-${dpi}/"; |
| 118 | + if (-d $folder) |
| 119 | + { |
| 120 | + #$resfile = "${folder}/${dstfile}"; |
| 121 | + #$cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile}"; |
| 122 | + #print "$cmd\n"; |
| 123 | + #$ret = system($cmd); |
| 124 | + #print "Failed!\n" if $ret != 0; |
| 125 | + |
| 126 | + $srcfile_2 = "${TEMP_DIR}/drk_${src_file}"; |
| 127 | + $resfile = "${folder}/drk_${dstfile}"; |
| 128 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 129 | + print "$cmd\n"; |
| 130 | + $ret = system($cmd); |
| 131 | + print "Failed!\n" if $ret != 0; |
| 132 | + |
| 133 | + $srcfile_2 = "${TEMP_DIR}/lgt_${src_file}"; |
| 134 | + $resfile = "${folder}/lgt_${dstfile}"; |
| 135 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 136 | + print "$cmd\n"; |
| 137 | + $ret = system($cmd); |
| 138 | + print "Failed!\n" if $ret != 0; |
| 139 | + |
| 140 | + $srcfile_2 = "${TEMP_DIR}/wdrk_${src_file}"; |
| 141 | + $resfile = "${folder}/wdrk_${dstfile}"; |
| 142 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 143 | + print "$cmd\n"; |
| 144 | + $ret = system($cmd); |
| 145 | + print "Failed!\n" if $ret != 0; |
| 146 | + |
| 147 | + $srcfile_2 = "${TEMP_DIR}/wlgt_${src_file}"; |
| 148 | + $resfile = "${folder}/wlgt_${dstfile}"; |
| 149 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 150 | + print "$cmd\n"; |
| 151 | + $ret = system($cmd); |
| 152 | + print "Failed!\n" if $ret != 0; |
| 153 | + } |
| 154 | + } |
| 155 | +} |
| 156 | + |
| 157 | +# action icons |
| 158 | +while (($srcfile, $dstfile) = each(%ic_actions_list)) |
| 159 | +{ |
| 160 | + makeTemp($srcfile); |
| 161 | + while (($dpi, $size) = each(%ic_actions_sizes)) |
| 162 | + { |
| 163 | + $folder = "${TARGET_DIR}/drawable-${dpi}/"; |
| 164 | + if (-d $folder) |
| 165 | + { |
| 166 | + #$resfile = "${folder}/${dstfile}"; |
| 167 | + #$cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile}"; |
| 168 | + #print "$cmd\n"; |
| 169 | + #$ret = system($cmd); |
| 170 | + #print "Failed!\n" if $ret != 0; |
| 171 | + |
| 172 | + $srcfile_2 = "${TEMP_DIR}/drk_${src_file}"; |
| 173 | + $resfile = "${folder}/drk_${dstfile}"; |
| 174 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 175 | + print "$cmd\n"; |
| 176 | + $ret = system($cmd); |
| 177 | + print "Failed!\n" if $ret != 0; |
| 178 | + |
| 179 | + $srcfile_2 = "${TEMP_DIR}/lgt_${src_file}"; |
| 180 | + $resfile = "${folder}/lgt_${dstfile}"; |
| 181 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 182 | + print "$cmd\n"; |
| 183 | + $ret = system($cmd); |
| 184 | + print "Failed!\n" if $ret != 0; |
| 185 | + |
| 186 | + $srcfile_2 = "${TEMP_DIR}/wdrk_${src_file}"; |
| 187 | + $resfile = "${folder}/wdrk_${dstfile}"; |
| 188 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 189 | + print "$cmd\n"; |
| 190 | + $ret = system($cmd); |
| 191 | + print "Failed!\n" if $ret != 0; |
| 192 | + |
| 193 | + $srcfile_2 = "${TEMP_DIR}/wlgt_${src_file}"; |
| 194 | + $resfile = "${folder}/wlgt_${dstfile}"; |
| 195 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 196 | + print "$cmd\n"; |
| 197 | + $ret = system($cmd); |
| 198 | + print "Failed!\n" if $ret != 0; |
| 199 | + } |
| 200 | + } |
| 201 | +} |
| 202 | + |
| 203 | +# menu icons |
| 204 | +while (($srcfile, $dstfile) = each(%ic_menu_list)) |
| 205 | +{ |
| 206 | + makeTemp($srcfile); |
| 207 | + while (($dpi, $size) = each(%ic_menu_sizes)) |
| 208 | + { |
| 209 | + $folder = "${TARGET_DIR}/drawable-${dpi}/"; |
| 210 | + if (-d $folder) |
| 211 | + { |
| 212 | + #$resfile = "${folder}/${dstfile}"; |
| 213 | + #$cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile}"; |
| 214 | + #print "$cmd\n"; |
| 215 | + #$ret = system($cmd); |
| 216 | + #print "Failed!\n" if $ret != 0; |
| 217 | + |
| 218 | + $srcfile_2 = "${TEMP_DIR}/drk_${src_file}"; |
| 219 | + $resfile = "${folder}/drk_${dstfile}"; |
| 220 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 221 | + print "$cmd\n"; |
| 222 | + $ret = system($cmd); |
| 223 | + print "Failed!\n" if $ret != 0; |
| 224 | + |
| 225 | + $srcfile_2 = "${TEMP_DIR}/lgt_${src_file}"; |
| 226 | + $resfile = "${folder}/lgt_${dstfile}"; |
| 227 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 228 | + print "$cmd\n"; |
| 229 | + $ret = system($cmd); |
| 230 | + print "Failed!\n" if $ret != 0; |
| 231 | + |
| 232 | + $srcfile_2 = "${TEMP_DIR}/wdrk_${src_file}"; |
| 233 | + $resfile = "${folder}/wdrk_${dstfile}"; |
| 234 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 235 | + print "$cmd\n"; |
| 236 | + $ret = system($cmd); |
| 237 | + print "Failed!\n" if $ret != 0; |
| 238 | + |
| 239 | + $srcfile_2 = "${TEMP_DIR}/wlgt_${src_file}"; |
| 240 | + $resfile = "${folder}/wlgt_${dstfile}"; |
| 241 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 242 | + print "$cmd\n"; |
| 243 | + $ret = system($cmd); |
| 244 | + print "Failed!\n" if $ret != 0; |
| 245 | + } |
| 246 | + } |
| 247 | +} |
| 248 | + |
| 249 | +# launcher icons |
| 250 | +while (($srcfile, $dstfile) = each(%ic_launcher_list)) |
| 251 | +{ |
| 252 | + makeTemp($srcfile); |
| 253 | + while (($dpi, $size) = each(%ic_launcher_sizes)) |
| 254 | + { |
| 255 | + $folder = "${TARGET_DIR}/drawable-${dpi}/"; |
| 256 | + if (-d $folder) |
| 257 | + { |
| 258 | + #$resfile = "${folder}/${dstfile}"; |
| 259 | + #$cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile}"; |
| 260 | + #print "$cmd\n"; |
| 261 | + #$ret = system($cmd); |
| 262 | + #print "Failed!\n" if $ret != 0; |
| 263 | + |
| 264 | + $srcfile_2 = "${TEMP_DIR}/drk_${src_file}"; |
| 265 | + $resfile = "${folder}/drk_${dstfile}"; |
| 266 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 267 | + print "$cmd\n"; |
| 268 | + $ret = system($cmd); |
| 269 | + print "Failed!\n" if $ret != 0; |
| 270 | + |
| 271 | + $srcfile_2 = "${TEMP_DIR}/lgt_${src_file}"; |
| 272 | + $resfile = "${folder}/lgt_${dstfile}"; |
| 273 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 274 | + print "$cmd\n"; |
| 275 | + $ret = system($cmd); |
| 276 | + print "Failed!\n" if $ret != 0; |
| 277 | + |
| 278 | + $srcfile_2 = "${TEMP_DIR}/wdrk_${src_file}"; |
| 279 | + $resfile = "${folder}/wdrk_${dstfile}"; |
| 280 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 281 | + print "$cmd\n"; |
| 282 | + $ret = system($cmd); |
| 283 | + print "Failed!\n" if $ret != 0; |
| 284 | + |
| 285 | + $srcfile_2 = "${TEMP_DIR}/wlgt_${src_file}"; |
| 286 | + $resfile = "${folder}/wlgt_${dstfile}"; |
| 287 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 288 | + print "$cmd\n"; |
| 289 | + $ret = system($cmd); |
| 290 | + print "Failed!\n" if $ret != 0; |
| 291 | + } |
| 292 | + } |
| 293 | +} |
| 294 | + |
| 295 | +# bigicons |
| 296 | +while (($srcfile, $dstfile) = each(%ic_bigicons_list)) |
| 297 | +{ |
| 298 | + makeTemp($srcfile); |
| 299 | + while (($dpi, $size) = each(%ic_bigicons_sizes)) |
| 300 | + { |
| 301 | + $folder = "${TARGET_DIR}/drawable-${dpi}/"; |
| 302 | + if (-d $folder) |
| 303 | + { |
| 304 | + #$resfile = "${folder}/${dstfile}"; |
| 305 | + #$cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile}"; |
| 306 | + #print "$cmd\n"; |
| 307 | + #$ret = system($cmd); |
| 308 | + #print "Failed!\n" if $ret != 0; |
| 309 | + |
| 310 | + $srcfile_2 = "${TEMP_DIR}/drk_${src_file}"; |
| 311 | + $resfile = "${folder}/drk_${dstfile}"; |
| 312 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 313 | + print "$cmd\n"; |
| 314 | + $ret = system($cmd); |
| 315 | + print "Failed!\n" if $ret != 0; |
| 316 | + |
| 317 | + $srcfile_2 = "${TEMP_DIR}/lgt_${src_file}"; |
| 318 | + $resfile = "${folder}/lgt_${dstfile}"; |
| 319 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 320 | + print "$cmd\n"; |
| 321 | + $ret = system($cmd); |
| 322 | + print "Failed!\n" if $ret != 0; |
| 323 | + |
| 324 | + $srcfile_2 = "${TEMP_DIR}/wdrk_${src_file}"; |
| 325 | + $resfile = "${folder}/wdrk_${dstfile}"; |
| 326 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 327 | + print "$cmd\n"; |
| 328 | + $ret = system($cmd); |
| 329 | + print "Failed!\n" if $ret != 0; |
| 330 | + |
| 331 | + $srcfile_2 = "${TEMP_DIR}/wlgt_${src_file}"; |
| 332 | + $resfile = "${folder}/wlgt_${dstfile}"; |
| 333 | + $cmd = "inkscape -z -e ${resfile} -w ${size} -h ${size} ${srcfile_2}"; |
| 334 | + print "$cmd\n"; |
| 335 | + $ret = system($cmd); |
| 336 | + print "Failed!\n" if $ret != 0; |
| 337 | + } |
| 338 | + } |
| 339 | +} |
0 commit comments