Re: embedding xpm images in your perl scripts



Dov Grobgeld said:
In one of my good old Tk programs I have the following code:

    sub create_pixmaps {
        $pix{dynamite} = <<__;
[snip contents of an xpm file as a here-document]
    __
    # more images created here
    :
    }
    :
    $killicon = $w::top->Pixmap(-data=>$pix{dynamite});

that's quite cool, but this is not quite what the Gdk-Pixbuf APIs do.  we
could add such functionality, but it would be in a helper module.


Changing it to Perl-syntax would make the data not adher to
the XPM format anymore...

depends on your point of view; is the data in the C header the format, or is
the text in the file the format?  the APIs which gtk2-perl wraps takes the
former view, whereas the Tk example you gave takes the latter.

Btw, I think we should also be able to do
inline of png images. These are preferably stored in perl in uuencoded
format...

once again, Gdk-Pixbuf has a way to include images inline, but it's not
uuencoded file contents.  in fact, mapping gdk_pixbuf_new_from_inline() to
Perl is quite a headache, so i don't disagree that your suggestion would be
nice --- but it's adding functionality that doesn't exist in the underlying
library, so it would probably go into a helper module (like Gtk2::Helper).

if you want to contribute such code, then by all means, please do.  :-) 
otherwise, you'll have to wait, as it's low on my priority list, since there
is a working (although less than perfect) solution for inlined images, whereas
there is no working solution for implementing GInterfaces or Bonobo controls.

-- 
muppet <scott at asofyet dot org>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]