Is there an easy way to print a generic GtkImage to a cairo context?  I
currently have code that in essence does the following:

    image = GTK_IMAGE(gtk_image_new_from_file(data->filename));
    pixbuf = gtk_image_get_pixbuf(image);
    cr = gtk_print_context_get_cairo_context(print_context);
    gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y);

This works well for printing the images that are loaded from a file, but
fails when the file can't be read and gtk_image_new_from_file() returns
the stock "broken image" icon.  I know I can get the image type via
gtk_image_get_storage_type() and build a case statement to handle the
various image types, specifically the GTK_IMAGE_STOCK type, but I was
hoping there was an easier and more generic way to do this.  I know that
GtkImage renders to a cairo context in order to draw on the screen, I
was hoping to leverage the same for rendering to a print context.

Am I missing something totally obvious?  Thanks.

David


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to