Re: embedded icons




I don't know of any modules off the top of my head
but you can do something like this:

--example

  my @default_icon_xpm_data = (
  '9 9 2 1',
  '       c None',
  '.      c #000000',
  '         ',
  ' ... ... ',
  ' ..   .. ',
  ' . . . . ',
  '    .    ',
  ' . . . . ',
  ' ..   .. ',
  ' ... ... ',
  '         '
  );

  Gtk2::Gdk::Pixbuf->new_from_xpm_data(@resize_xpm_data)
  my $pixb = Gtk2::Gdk::Pixbuf->new_from_xpm_data(@default_icon_xpm_data);
  my ($pixmap,$mask)= $pixb->render_pixmap_and_mask(100);
  my $img=Gtk2::Image->new_from_pixmap($pixmap,$mask);

--end of example

you can save the icon you want to embed as an xpm file, then open it in
a text editor, and copy the data lines into a perl list as above.
(the xpm file format is actually C code for a list of strings).

cheers,
Chris


On Fri, 28 May 2010 12:00:21 +0000
gtk-perl-list-request gnome org wrote:

Date: Fri, 28 May 2010 05:24:21 -0500
From: "Zane C.B." <v velox vvelox net>
Any one know of any modules or etc that make embedding a icon in the
Perl code easy?



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