Thank you Anonymous Monk! I am now able to create a Wx::Bitmap from XPM data. Using the newFromXPM constructor, and passing it array-refs. Contrary to newFromBits, newFromXPM expext ( $dat-array-ref ) only and not ( $data, sizeX, sizeY ) as FromBits. I use Wx itself to convert the gifs via a simple utility script and write a Lib.pm, for anyone interested (some magic excluded..):
Wx::InitAllImageHandlers();
my $bmp = Wx::Bitmap->new("$_", wxBITMAP_TYPE_GIF);
my $ok = $bmp->SaveFile("$fname.xpm", wxBITMAP_TYPE_XPM);
open(my $dat, "$fname.xpm") || die("Could not open file! $fname.xp
+m $!");
my @raw_data=<$dat>;
close($dat);
my @filtered;
for(@raw_data){
next if $_ =~ /^\/\*/;
next if $_ =~ /^static/;
next if $_ =~ /^\}/;
$_ =~ s/\@/\\@/g;
$_ =~ s/\$/\\\$/g;
$_ =~ s/\&/\\&/g;
$_ =~ s/\%/\\%/g;
push(@filtered,$_);
}
my $data = join('',@filtered);
$vars .= "\$images->{$fname}\t= [". $data ."];\n\n";
A working example of a script using this approach can be found on this blog post:
WxPerl: Converting images for use as embedded XPM in your Perl code
BTW: Am I the only one who has another password since the break-in, forgets about it, and when posting after a fast login notices *after* posting that he/she has posted as anonymous... (Happened on this thread when I provided the working example...) ;)