[Xfce4-commits] <ristretto:ristretto-0.0> Implement first rudimentary printing support
Stephan Arts
noreply at xfce.org
Sun Oct 23 19:16:36 CEST 2011
Updating branch refs/heads/ristretto-0.0
to 77ca2890d1c29041719b07704c05dc064d88bf46 (commit)
from feebe0cf4c3df003121cb97768ef2d7e7e3f36c3 (commit)
commit 77ca2890d1c29041719b07704c05dc064d88bf46
Author: Stephan Arts <stephan at xfce.org>
Date: Mon May 18 00:38:39 2009 +0200
Implement first rudimentary printing support
ChangeLog | 4 ++++
src/main_window.c | 25 ++++++++++---------------
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5ff90b6..db03ec5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-17 Stephan Arts <stephan at xfce.org>
+
+ * src/main_window.c: Implement first rudimentary printing.
+
2009-05-16 Stephan Arts <stephan at xfce.org>
* src/main_window.c
diff --git a/src/main_window.c b/src/main_window.c
index b6e39d5..1d4fcd3 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -1181,11 +1181,15 @@ cb_rstto_main_window_print (GtkWidget *widget, RsttoMainWindow *window)
{
GtkPrintSettings *print_settings = gtk_print_settings_new ();
- g_object_set (print_settings,
- "export-filename", "test.pdf",
- NULL);
+ gtk_print_settings_set_resolution (print_settings, 300);
+
GtkPrintOperation *print_operation = gtk_print_operation_new ();
+
gtk_print_operation_set_print_settings (print_operation, print_settings);
+
+ g_object_set (print_operation,
+ "n-pages", 1,
+ NULL);
g_signal_connect (print_operation, "draw-page", G_CALLBACK (rstto_main_window_print_draw_page), window);
@@ -1199,23 +1203,14 @@ rstto_main_window_print_draw_page (GtkPrintOperation *operation,
gint page_nr,
RsttoMainWindow *window)
{
- g_debug ("%s", __FUNCTION__);
RsttoImage *image = rstto_navigator_iter_get_image (window->priv->iter);
GdkPixbuf *pixbuf = rstto_image_get_pixbuf (image);
- guchar *data = gdk_pixbuf_get_pixels (pixbuf);
- gint width = gdk_pixbuf_get_width (pixbuf);
- gint height = gdk_pixbuf_get_height (pixbuf);
- gint rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-
- cairo_surface_t *surface = cairo_image_surface_create_for_data (data,
- CAIRO_FORMAT_RGB24,
- width,
- height,
- rowstride);
cairo_t *context = gtk_print_context_get_cairo_context (print_context);
- cairo_set_source_surface (context, surface, 0, 0);
+ gdk_cairo_set_source_pixbuf (context, pixbuf, 0, 0);
+ //cairo_scale (context, 1000, 1000);
+ cairo_paint (context);
}
More information about the Xfce4-commits
mailing list