Saving a Drawable to Disk



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).

I can save the data array to disk in ppm format but
I do not know how to include the overlaid graphics.

I can see two ways it might be possible. 

1. When using the gdk_draw_line() I can have this draw to
the data array rather than the drawable on the screen. This would
put the lines right into the data array. I could save this and
then display the data + the lines by using the gdk_draw_gray_image()
command.

2. A command exists which would convert a drawable to a data array.
Then I could draw everyting, do a "screen capture" by converting
the drawable to a data array, then save the data array.

 I don't know how or if it is possible to do either method. If
anyone can help me I would appreciate it. Thank you.

Stewart






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