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