Re: Gtk2::PrintOperation

On 07.08.2010 09:30, Emmanuele Bassi wrote:
Thanks for the help. This line got me one step further:

   Gtk2::Gdk::Cairo::Context::set_source_pixbuf( $cr, $pixbuf, 0, 0 );

Why isn't set_source_pixbuf in Cairo::Context?

well, Cairo doesn't know anything about GdkPixbufs, so perl-Gtk2 has to
"sub-class" the Cairo::Context by adding a Gtk2::Gdk::Cairo::Context
type to its @ISA. while perl-Gtk2 does it for the one returned by
Gtk2::Gdk::Cairo::create(), it doesn't do it for the one created by the
Gtk2::PrintContext API[0].

We could, however, adjust the xsub for gtk_print_context_get_cairo_context such that it re-bless()-es the cairo context into the Gtk2::Gdk::Cairo package. It looks like every method in Gtk2::Gdk::Cairo can be safely called on any kind of context (or, rather, any context with any kind of surface). Patches welcome.

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