Draw in a GdkPixbuf



Hi list!

I'm trying to find a way to draw in a GdkPixbuf (for example draw a rectangle on the pixbuf) and save the result to a file afterwards.

I found in devhelp the gdk_draw_* functions, but to use them I need a GdkPixmap. gdk_pixmap_new requires a GdkDrawable. The problem is that I'm developping a command line application, so I don't use GTK, only glib, gdk, and gdk-pixbuf. Even creating the GdkPixmap with a NULL GdkDrawable, I can't workaround the problem, because the documentation of gdk_draw_pixbuf tells me that "All windows have a colormap, however, pixmaps only have colormap by default if they were created with a non-NULL window argument. Otherwise a colormap must be set on them with gdk_drawable_set_colormap()". Trying to get a colormap requires other stuff, which requires other stuff, and so on...

As this seems to be quite old-fashioned way of doing things, I tried to see if cairo could do the trick. But it seems there's no way to draw to a GdkPixbuf with cairo (I'm unfamiliar with cairo).

So, does anyone have an hint on how to draw and save an image from a GdkPixbuf, with gdk or cairo ?

Thanks for you help,

Luis



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