#include static void begin_print (GtkPrintOperation *operation, GtkPrintContext *context) { gtk_print_operation_set_n_pages (operation, 1); } static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr) { cairo_t *cr; GTimer *timer; cr = gtk_print_context_get_cairo_context (context); cairo_set_line_width (cr, 1); cairo_set_source_rgb (cr, 1., 0., 0.); cairo_rectangle (cr, 0.000000, 359.000000, 9599.999712, 11509.999712); timer = g_timer_new (); g_print ("gonna call cairo_stroke\n"); cairo_stroke (cr); g_print ("cairo_stroke took %f s\n", g_timer_elapsed (timer, NULL)); g_timer_destroy (timer); } int main (int argc, char *argv[]) { GtkPrintOperation *operation; GError *error = NULL; gtk_init (&argc, &argv); operation = gtk_print_operation_new (); g_signal_connect (G_OBJECT (operation), "begin-print", G_CALLBACK (begin_print), NULL); g_signal_connect (G_OBJECT (operation), "draw-page", G_CALLBACK (draw_page), NULL); gtk_print_operation_run (operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, NULL); gtk_main (); g_object_unref (operation); return 0; }