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...) ;)

In reply to Re: What's wrong with this Wx::Bitmap construction? by isync
in thread What's wrong with this Wx::Bitmap construction? by isync

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.