Re: loading an image from data, not file

* zentara <zentara zentara net> [2005-01-19 18:47]:
my $loader = Gtk2::Gdk::PixbufLoader->new;
  $loader->write ($image_data);
  my $pixbuf = $loader->get_pixbuf;

OT: I like to partition things like into smaller scopes:

    my $pixbuf = do {
        my $loader = Gtk2::Gdk::PixbufLoader->new();
        $loader->write( $image_data );

So the next guy who looks at it doesn't have to wonder if $loader
is used anywhere later, and can see that the entire point of this
mumbo jumbo is to load something into $pixbuf.

*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}

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