Skip to content

Instantly share code, notes, and snippets.

@onlyshk
Created July 20, 2010 13:50
Show Gist options
  • Save onlyshk/482979 to your computer and use it in GitHub Desktop.
Save onlyshk/482979 to your computer and use it in GitHub Desktop.
static void draw_page (GtkPrintOperation * oper, GtkPrintContext * context,
gint nr, gpointer user_data)
{
//GList* list = NULL;
GdkPixbuf* pixbuf = NULL;
MainWin* mw = (MainWin*)user_data;
int n = g_list_length (mw->img_list);
int i = 0;
cairo_t *cr = gtk_print_context_get_cairo_context (context);
cairo_surface_t *image;
for (i; i < n; ++i)
{
pixbuf = gdk_pixbuf_new_from_file(image_list_get_current_file_path (mw->img_list),NULL);
pixbuf = gdk_pixbuf_scale_simple (pixbuf,
197, 210,
GDK_INTERP_HYPER);
gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
if (!mw->img_list->current->next )
image_list_get_first(mw->img_list);
else
image_list_get_next(mw->img_list);
}
cairo_paint (cr);
g_object_unref (pixbuf);
//g_list_free(list);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment