Re: How to use cairo with gtk



On Sat, 2008-03-29 at 15:37 -0400, zentara wrote:

I found that if I used $surface->get_data  it was much more error prone, than if I used
the  $surface->write_to_png_stream

A minor style note.  Instead of this:

  my $output='';
  $surface->write_to_png_stream (sub {
   my ($closure, $data) = @_;
   $output .= $data;
   });

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

You can do this:

  my $loader = Gtk2::Gdk::PixbufLoader->new;
  $surface->write_to_png_stream (sub {
    my ($closure, $data) = @_;
    $loader->write($data);
  });
  $loader->close;

-- 
Bye,
-Torsten




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