Re: Saving a Drawable to Disk



Hi,

Stewart John Moorehead <sjm ux2 sp cs cmu edu> writes:

> I am writing an application where I draw some data
> to the screen using gdk_draw_gray_image(). The data is
> stored in a 2D array of unsigned chars.
> I then draw overtop of this using gdk_draw_line(). This
> works fine and everything displays as desired. Now I want
> to save the image I have on the screen to disk as
> a picture (I prefer ppm but gif, jpg etc is fine).

you can use gdk_pixbuf_get_from_drawable() and gdk_pixbuf_save()
but I'm not sure if the latter is in gdk-pixbuf stable. gdk-pibxuf
as includes with gtk+-2.0 has this function.

on the other hand, doing a bresenham line drawing algo on the 
data array wouldn't be too hard neither.


Salut, Sven




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