Re: embedded icons (solved)



On Fri, 2010-05-28 at 08:48 -0500, Zane C.B. wrote: 
On Fri, 28 May 2010 05:24:21 -0500
"Zane C.B." <v velox vvelox net> wrote:

Any one know of any modules or etc that make embedding a icon in the
Perl code easy?

Solved this using XPM. The format is very easy to escape and embed.

Yes, XPM is good for that purpose.  Another alternative is to use the
contents of a PNG file as a base64_encoded block:

my $png_data = decode_base64(<<'EOF');
iVBORw0KGgoAAAANSUhEUgAAAIcAAABTCAMAAACCluQBAAAAwFBMVEW7u7gwIiIrKyhBJyM8Ojc3
O0BkMzE6QlZSPDxxMS46Tjk7R2NASVBhPjtDTEdOSEo7TXGBNjQ8YDp2Q0OFQ0FFWX4/WY9MYUyc
PjxnV1haXVxTXXOURkRAYJ49djxBZa2rSEZAa7u3RkVReFE/b8o6jTnFR0Vsb25BdNg7eOlFduFk
...
a2zP5zW3xZQ0fuOLYRfxved9wZTfwdzffm4xfuVy3qzzw3Cx7m0Xw8vHf/sainxj8/EvuJzo499x
HT7+B67/AKql/D/6JY9WAAAAAElFTkSuQmCC
EOF

my $loader = Gtk2::Gdk::PixbufLoader->new;
$loader->write($png_data);
$loader->close;
return $loader->get_pixbuf;

XPM has the advantage that you can edit the image with your text editor,
but the PNG option is useful with larger more detailed images.

Cheers
Grant




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