Re: export GdkPixmap to graphics file?

gdk_pixbuf_save (pixbuf, save_filename, "png", &error, NULL);

For more detail see:


Thanks for the response.  That looks something like what I'm looking
for. The reason that I didn't find that documentation was that I was looking
for a function that worked on a GdkPixmap... the documentation that you
showed me was for GkkPixbuf.

I don't yet know the difference between gdkpixmap and gdkpixbuf, but
presumably there is a conversion function between the two.?  Neither
page I'm looking at mentions the other.

Somebody on the cairo list gave me another potential solution to my
problem.  I can get a cairo_surface_t from a cairo_t by calling:

cairo_surface_t* cairo_get_target           (cairo_t *cr);

and then call:
cairo_status_t cairo_surface_write_to_png   (cairo_surface_t *surface,
                                            const char *filename);

I haven't tried this yet, but since I'm using cairo to create the gdkpixmap,
this will probably work for me.  However, the function you pointed me to
would be more general because it doesn't require cairo.  For the sake
of somebody who googles this thread someday, can somebody post
how to convert between GdkPixbuf and GdkPixmap?  I found this

GdkPixbuf *gdk_pixbuf_get_from_drawable(GdkPixbuf *dest,
   GdkDrawable *src, GdkColormap *cmap, int src_x, int src_y,
   int dest_x, int dest_y, int width, int height);

Is that how one would convert from a GdkPixmap to a GdkPixbuf?




On 12/15/06, David L <idht4n hotmail com> wrote:

I'm using cairo to create a GdkPixmap that I display in a
gtk drawing area.  I'd like to create a graphics file with the
content of the pixbuf when I click on the drawing area.  Is
there a simple function to create some kind of graphics
file from a GdkPixmap?  I've thought of just drawing
everything twice, once into the pixmap and once into a
cairo_surface_t structure and then using cairo's surface
to file export functions to create the file, but that seems
pretty wasteful because I'd be drawing every object twice.
So is there any function that I can call like this:

GdkPixmapWriteToPng(GdkPixmap *,
                                             const char *filename);



View Athlete's Collections with Live Search

gtk-list mailing list
gtk-list gnome org

Dave vs. Carl: The Insignificant Championship Series.  Who will win?

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