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.
26 # list of icons for strip
28 "mimetypes/audio-x-generic", # Icon_Audio
29 "places/folder", # Icon_Folder
30 "actions/format-indent-more", # Icon_Playlist
31 "actions/media-playback-start", # Icon_Cursor ###
32 "apps/preferences-desktop-wallpaper", # Icon_Wps
33 "devices/computer", # Icon_Firmware ###
34 "apps/preferences-desktop-font", # Icon_Font
35 "apps/preferences-desktop-locale", # Icon_Language
36 "categories/preferences-system", # Icon_Config
37 "status/software-update-available", # Icon_Plugin
38 "actions/bookmark-new", # Icon_Bookmark
39 "places/start-here", # Icon_Preset
40 "actions/go-jump", # Icon_Queued
41 "actions/go-next", # Icon_Moving
42 "devices/input-keyboard", # Icon_Keyboard
43 "actions/mail-send-receive", # Icon_Reverse_Cursor
44 "apps/help-browser", # Icon_Questionmark
45 "actions/document-properties", # Icon_Menu_setting
46 "categories/applications-other", # Icon_Menu_functioncall
47 "actions/list-add", # Icon_Submenu
48 "categories/preferences-system", # Icon_Submenu_Entered
49 "actions/media-record", # Icon_Recording
50 "devices/audio-input-microphone", # Icon_Voice ###
51 "categories/preferences-desktop", # Icon_General_settings_menu
52 "categories/applications-other", # Icon_System_menu
53 "actions/media-playback-start", # Icon_Playback_menu
54 "devices/video-display", # Icon_Display_menu
55 "devices/video-display", # Icon_Remote_Display_menu
56 "devices/network-wireless", # Icon_Radio_screen ###
57 "mimetypes/package-x-generic", # Icon_file_view_menu
58 "apps/utilities-system-monitor", # Icon_EQ
59 "../rbutil/rbutilqt/icons/rockbox-clef.svg" # Icon_Rockbox
64 print "Usage: $0 <path to iconset> <size>\n";
67 my $tangopath = $ARGV[0];
71 my $alphatemp = File
::Temp
->new(SUFFIX
=> ".png");
72 my $alphatempfname = $alphatemp->filename();
73 my $exporttemp = File
::Temp
->new(SUFFIX
=> ".png");
74 my $exporttempfname = $exporttemp->filename();
75 my $tempstrip = File
::Temp
->new(SUFFIX
=> ".png");
76 my $tempstripfname = $tempstrip->filename();
78 my $newoutput = "tango_icons.$size.bmp";
81 die("output file $newoutput does already exist!");
84 print "Creating icon strip as $newoutput\n\n";
89 print "processing $_ ...\n";
92 # if nothing is defined make it empty / transparent
93 my $s = $size . "x" . $size;
94 `convert -size $s xc:"#f0f" $exporttempfname`
97 # icon is inside the Rockbox tree
99 `inkscape --export-png=$exporttempfname --export-width=$size --export-height=$size $file`
102 # icon is inside the tango tree
103 $file = "$tangopath/scalable/" . $_ . ".svg";
104 `inkscape --export-png=$exporttempfname --export-width=$size --export-height=$size $file`
107 `convert -append $tempstripfname $exporttempfname $tempstripfname`;
110 `convert $exporttempfname $tempstripfname`;
114 print "masking and converting result ...\n";
116 `convert $tempstripfname -alpha extract -monochrome -negate -alpha copy -colorize 0,100,0 $alphatempfname`;
117 # combine mask with image and drop transparency and scale down
118 `convert -composite $tempstripfname $alphatempfname -flatten -background '#f0f' -alpha off $newoutput`;