how to copy a specific area of a GtkWindow to GdkImage



OOPS, I have asked a stupid question about converting GdkPixmap to
GdkDrawable before, I am sorry, it is the error of my programming, so
forget that question.

The new problem is :
    I try to copy a specific area  of the background of a GtkWindow to
GdkPixmap.

So what I did is:
    1. set up a pixmap as the background of the GtkWindow, so that I
already did gtk_widget_realize(gtkwindow).
    2. I use GdkImage *image=gdk_image_get(gtkwindow->window,0,0,100,100)
to copy the specific area of the
       GtkWindow to a GdkImage first.
    3. use gdk_draw_pixmap(..) to copy that GdkImage to GdkPixmap.

But I failed on step 2. it shows system error as the following:
    Gdk-ERROR **: BadMatch (invalid parameter attributes)
    serial 337 error_code 8 request_code 73 minor_code 0

I wonder what it is and why?
And how I can copy a specific area of a background of a GdkWindow to a
GdkImage, so that I can finaly copy it to a GdkPixmap?

Thanks!!!!

Forget the following question, I am sorry, my fault.

Jiang XU wrote:

> I try to copy the specific area of a GdkWindow to a GdkPixmap for
> further use.
> I first create a GdkPixmap using gdk_pixmap_new(..)
> then I copy the specific area of a GdkWindow to a GdkImage by using
> image=gdk_image_get(gdkwindow,...)
> Then, I try to use gdk_draw_image to draw the GdkImage to the GdkPixmap.
>
> but eh gdk_draw_image needs the first parameter to be GdkDrawable
>         gdk_draw_image(GdkDrawable *, ...)
>
> In the online Gtk Tutorial 23.3, it said GdkPixmap is GdkDrawable and
> even show an example.
> But when I compile my program, it shows error message which is "can not
> convert from GdkPixmap * to GdkDrawable *).
>
> So I wonder how to convert a GdkPixmap * to GdkDrawable *
> Or, is there some easy ways to copy a specific area of a GdkWindow to a
> GdkPixmap?
>
> Thanks
>
> Jiang



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