Re: export GdkPixmap to graphics file?
- From: "David L" <idht4n hotmail com>
- To: dov grobgeld gmail com
- Cc: gtk-list gnome org
- Subject: Re: export GdkPixmap to graphics file?
- Date: Tue, 26 Dec 2006 15:10:45 -0800
gdk_pixbuf_save (pixbuf, save_filename, "png", &error, NULL);
For more detail see:
http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-file-saving.html
Dov,
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.
http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-file-saving.html
vs
http://developer.gnome.org/doc/API/gdk/gdk-bitmaps-and-pixmaps.html#GDKPIXMAP
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
function:
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?
Thanks,
David
Regards,
Dov
On 12/15/06, David L <idht4n hotmail com> wrote:
Hi,
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);
Thanks...
David
_________________________________________________________________
View Athlete's Collections with Live Search
http://sportmaps.live.com/index.html?source=hmemailtaglinenov06&FORM=MGAC01
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
_________________________________________________________________
Dave vs. Carl: The Insignificant Championship Series. Who will win?
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://davevscarl.spaces.live.com/?icid=T001MSN38C07001
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]