[Gnome-print] pixbuf print method ...




	This is sort of nasty since it includes gdk-pixbuf.h in
gnome-print.h; we could of couse do the same with

	typedef struct _GdkPixbuf GdkPixbuf;

	Naughty but nice in terms of speed. It would be nice to have the
print_pixbuf API to stop people forgetting alpha and to reduce lines of
code count in my eog bonobo component.

	Regards,

		Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot
? mig
? tmp.txt
? gmon.out
? tmp.mta
? print.patch
Index: libgnomeprint/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-print/libgnomeprint/ChangeLog,v
retrieving revision 1.110
diff -u -r1.110 ChangeLog
--- libgnomeprint/ChangeLog	2000/06/17 00:11:42	1.110
+++ libgnomeprint/ChangeLog	2000/06/19 13:49:07
@@ -1,7 +1,12 @@
+2000-06-19  Michael Meeks  <michael@helixcode.com>
+
+	* gnome-print.c (gnome_print_pixbuf): implement.
+
 2000-06-16  Chema Celorio  <chema@celorio.com>
 
 	* gnome-print-dialog.h: added a GNOME_PRINT_RANGE_SELECTION_UNSENSITIVE
 	usefull for dialogs when no selection is active.
+	
 	* gnome-print-dialog.c: code to handle it
 
 2000-06-14  Lauris Kaplinski  <lauris@helixcode.com>
Index: libgnomeprint/gnome-print.c
===================================================================
RCS file: /cvs/gnome/gnome-print/libgnomeprint/gnome-print.c,v
retrieving revision 1.24
diff -u -r1.24 gnome-print.c
--- libgnomeprint/gnome-print.c	1997/01/02 04:05:39	1.24
+++ libgnomeprint/gnome-print.c	2000/06/19 13:49:07
@@ -439,6 +439,24 @@
 }
 
 int
+gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf)
+{
+	if (gdk_pixbuf_get_has_alpha (pixbuf))
+		gnome_print_rgbaimage  (pc,
+					gdk_pixbuf_get_pixels    (pixbuf),
+					gdk_pixbuf_get_width     (pixbuf),
+					gdk_pixbuf_get_height    (pixbuf),
+					gdk_pixbuf_get_rowstride (pixbuf));
+	else
+		gnome_print_rgbimage  (pc,
+				       gdk_pixbuf_get_pixels    (pixbuf),
+				       gdk_pixbuf_get_width     (pixbuf),
+				       gdk_pixbuf_get_height    (pixbuf),
+				       gdk_pixbuf_get_rowstride (pixbuf));
+	return 1;
+}
+
+int
 gnome_print_textline (GnomePrintContext *pc, GnomeTextLine *line)
 {
 	g_return_val_if_fail (pc != NULL, -1);
Index: libgnomeprint/gnome-print.h
===================================================================
RCS file: /cvs/gnome/gnome-print/libgnomeprint/gnome-print.h,v
retrieving revision 1.16
diff -u -r1.16 gnome-print.h
--- libgnomeprint/gnome-print.h	2000/04/15 13:43:06	1.16
+++ libgnomeprint/gnome-print.h	2000/06/19 13:49:07
@@ -2,6 +2,7 @@
 #define __GNOME_PRINT_H__
 
 #include <stdio.h> /* for FILE */
+#include <gdk-pixbuf/gdk-pixbuf.h>
 #include <libgnomeprint/gnome-printer.h>
 #include <libgnomeprint/gnome-font.h>
 #include <libgnomeprint/gnome-text.h>
@@ -192,7 +193,10 @@
 gnome_print_rgbimage         (GnomePrintContext *pc, const char *data, int width, int height, int rowstride);
 
 int
-gnome_print_rgbaimage         (GnomePrintContext *pc, const char *data, int width, int height, int rowstride);
+gnome_print_rgbaimage        (GnomePrintContext *pc, const char *data, int width, int height, int rowstride);
+
+int
+gnome_print_pixbuf           (GnomePrintContext *pc, GdkPixbuf *pixbuf);
 
 int
 gnome_print_textline	     (GnomePrintContext *pc, GnomeTextLine *line);


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