[Gnome-print] GnomePrintPixbuf syntax change



Hello gnome printers!

I mostly rewrote GnomePrintPixbuf printing context, to behave more like
its name suggest ;)

Exporting-your-document-to-RGB/RGBA-GdkPixbuf-HOWTO

1. Main program
pc = gnome_print_pixbuf_new (x0, y0, x1, y1, xdpi, ydpi, alpha)

  (x0, y0 - x1, y1) is rectangle, you want to export (usually page)
  dpi is dpi
  alpha is boolean

gtk_signal_connect (GTK_OBJECT (pc), "showpixbuf", your_handler, data)

print something to created context, do not forget showpage.

gnome_print_context_close (pc)

2. handler

void your_handler (GnomePrintPixbuf * gpb, GdkPixbuf * pb,
	gint pagenum gpointer data)

Handler is called during every showpage, before page count is increased
and drawing area cleared.
Pixbuf is unrefd, when signal handler returns. So if you want to keep it,
simply save it to somewhere and ref it. If you only want to write file,
you can do it readily in handler.
NB! pagenum-s start from 0

It uses fresh GnomePrintRBuf context, which knows quite well all relevant
printing features, including semitransparent fills and clipping. It is
somewhat tested with sodipodi too, but needs more, of course.

As a result libgnomeprint has now gdk_pixbuf dependency ;( - which
hopefully is no problem, as it already has gnome dependency ;)

Best wishes,
Lauris






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