3 # Given a list of input PNGs, create a C source file file
4 # containing a const array of XPMs, under the name `xpm_icon'.
9 # XPM format is generated directly by ImageMagick, so that's easy
10 # enough. We just have to adjust the declaration line so that it
11 # has the right name, linkage and storage class.
13 open XPM
, "convert $f xpm:- |";
14 push @lines, $_ while <XPM
>;
16 die "XPM from $f in unexpected format\n" unless $lines[1] =~ /^static.*\{$/;
17 $lines[1] = "static const char *const xpm_icon_$k"."[] = {\n";
19 push @xpms, @lines, "\n";
23 foreach $line (@xpms) { print $line; }
24 print "const char *const *const xpm_icons[] = {\n";
25 for ($i = 0; $i < $k; $i++) { print " xpm_icon_$i,\n"; }
27 print "const int n_xpm_icons = $k;\n";