3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 # Copyright (C) 2011 Dominik Riebeling
12 # All files in this archive are subject to the GNU General Public License.
13 # See the file COPYING in the source tree root for full license agreement.
15 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 # KIND, either express or implied.
19 # This script is to generate an iconset (iconstrip bmp file) from Tango icons.
20 # It should be usable for other iconsets that are provided as svg images. For
21 # those adjusting the paths to the icons might need adjustment.
22 # To be run from the icons/ folder in a Rockbox checkout.
27 # list of icons for strip
28 # Use relative paths to point to icons in the tree, relative to the icons/ folder
29 # (must start with . or ..)
30 # Other are treated relatively to the tango sources tree
32 "./tango-svg/audio-x-generic", # Icon_Audio
33 "./tango-svg/folder", # Icon_Folder
34 "./tango-svg/format-indent-more", # Icon_Playlist
35 "./new_icons-svg/media-playback-start-green", # Icon_Cursor ###
36 "./tango-svg/preferences-desktop-wallpaper", # Icon_Wps
37 "./tango-svg/media-flash", # Icon_Firmware ###
38 "./tango-svg/preferences-desktop-font", # Icon_Font
39 "./tango-svg/preferences-desktop-locale", # Icon_Language
40 "./tango-svg/preferences-system", # Icon_Config
41 "./tango-svg/software-update-available", # Icon_Plugin
42 "./tango-svg/bookmark-new", # Icon_Bookmark
43 "./tango-svg/start-here", # Icon_Preset
44 "./tango-svg/go-jump", # Icon_Queued
45 "./tango-svg/go-next", # Icon_Moving
46 "./tango-svg/input-keyboard", # Icon_Keyboard
47 "./tango-svg/go-previous", # Icon_Reverse_Cursor
48 "./tango-svg/help-browser", # Icon_Questionmark
49 "./tango-svg/document-properties", # Icon_Menu_setting
50 "./tango-svg/applications-other", # Icon_Menu_functioncall
51 "./tango-svg/list-add", # Icon_Submenu
52 "./tango-svg/preferences-system", # Icon_Submenu_Entered
53 "./tango-svg/media-record", # Icon_Recording
54 "./new_icons-svg/face-shout", # Icon_Voice ###
55 "./tango-svg/preferences-desktop", # Icon_General_settings_menu
56 "./tango-svg/emblem-system", # Icon_System_menu
57 "./tango-svg/media-playback-start", # Icon_Playback_menu
58 "./tango-svg/video-display", # Icon_Display_menu
59 "./tango-svg/network-receive", # Icon_Remote_Display_menu
60 "./tango-svg/network-wireless", # Icon_Radio_screen ###
61 "./tango-svg/system-file-manager", # Icon_file_view_menu
62 "./tango-svg/utilities-system-monitor", # Icon_EQ
63 "../docs/logo/rockbox-clef" # Icon_Rockbox
65 my @iconlist_viewers = (
66 "./tango-svg/applications-graphics", # bmp
67 "./tango-svg/applications-multimedia", # mpeg
68 "./tango-svg/applications-other", # ch8, tap, sna, tzx, z80
69 "./tango-svg/audio-x-generic", # mp3, mid, rmi, wav
70 "./tango-svg/format-justify-left", # txt, nfo
71 "./tango-svg/text-x-generic-template", # ss
72 "./mint-x-svg/applications-games", # gb, gbc
73 "./tango-svg/image-x-generic", # jpg, jpe, jpeg
74 "./tango-svg/format-indent-more", # m3u
75 "./mint-x-svg/gnome-glchess", # pgn
76 "./tango-svg/dialog-information", # zzz
85 my $output = "tango_icons";
87 GetOptions
( 'v' => \
$do_viewers,
88 't|tango-path=s' => \
$tangopath,
89 'o|output=s' => \
$output,
93 if($#ARGV != 0 or $help) {
94 print "Usage: $0 [-v] [-t <path to iconset>] [-o <output prefix>] SIZE\n";
96 print "\t-v\tGenerate viewer icons\n";
97 print "\t-t\tPath to source of tango iconset if required\n";
98 print "\t-t\tPath to source of tango iconset if required\n";
99 print "\t-o\tUse <output prefix> instead of \"tango_icons\" for the output filename\n";
101 print "\tSIZE can be in the form of NN or NNxNN and will be used for the output filename\n";
109 $output .= "_viewers";
110 @list = @iconlist_viewers;
113 my $alphatemp = File
::Temp
->new(SUFFIX
=> ".png");
114 my $alphatempfname = $alphatemp->filename();
115 my $exporttemp = File
::Temp
->new(SUFFIX
=> ".png");
116 my $exporttempfname = $exporttemp->filename();
117 my $tempstrip = File
::Temp
->new(SUFFIX
=> ".png");
118 my $tempstripfname = $tempstrip->filename();
120 my $newoutput = "$output.$size.bmp";
123 die("output file $newoutput does already exist!");
126 print "Creating icon strip as $newoutput\n\n";
132 print "processing $_ ...\n";
135 # if nothing is defined make it empty / transparent
136 my $s = $size . "x" . $size;
137 `convert -size $s xc:"#ff00ff" -alpha transparent $exporttempfname`
140 # icon is inside the Rockbox tree
142 `inkscape --export-png=$exporttempfname --export-width=$size --export-height=$size $file`
145 # icon is inside the tango tree
146 if ($tangopath eq "") {
147 print "Path to tango sources needed but not given!\n";
150 $file = "$tangopath/scalable/" . $_ . ".svg";
151 #~ `inkscape --export-png=$exporttempfname --export-width=$size --export-height=$size $file`
152 `cp $file tango-svg/`;
155 `convert -append $tempstripfname $exporttempfname $tempstripfname`;
158 `convert $exporttempfname $tempstripfname`;
162 print "Converting result ...\n";
163 `convert $tempstripfname $newoutput`;