Get window screenshot on 2.18.

View: New views
4 Messages — Rating Filter:   Alert me  

Get window screenshot on 2.18.

by Nikolay Zamosenchuk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good afternoon!
I'm experiencing some difficulties using 2.18 release.

I'm trying to get window screenshot using such code (working on
previous major releases, including 2.16):

        GdkWindowObject *private = (GdkWindowObject *)(window);
        GdkPixmap *internalPixmap = ((GdkWindowPaint
*)private->paint_stack->data)->pixmap;
        if (internalPixmap == NULL) {
                return NULL;
        }
        //
        GdkPixmap *pixmap = gdk_pixmap_new(internalPixmap, width, height, -1);
        GdkGC *gc = gdk_gc_new(internalPixmap);
        //
        gdk_draw_drawable(pixmap, gc, internalPixmap, 0, 0, 0, 0, width, height);

But I get nothing...
Can anyone help, please?


--
Best regards, Nikolay Zamosenchuk
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-devel-list

Get window screenshot on 2.18.

by Nikolay Zamosenchuk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good afternoon!
I'm experiencing some difficulties using 2.18 release.

I'm trying to get window screenshot using such code (working on
previous major releases, including 2.16):

       GdkWindowObject *private = (GdkWindowObject *)(window);
       GdkPixmap *internalPixmap = ((GdkWindowPaint
*)private->paint_stack->data)->pixmap;
       if (internalPixmap == NULL) {
               return NULL;
       }
       //
       GdkPixmap *pixmap = gdk_pixmap_new(internalPixmap, width, height, -1);
       GdkGC *gc = gdk_gc_new(internalPixmap);
       //
       gdk_draw_drawable(pixmap, gc, internalPixmap, 0, 0, 0, 0, width, height);

But I get nothing...
Can anyone help, please?


--
Best regards, Nikolay Zamosenchuk
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-devel-list

Re: Get window screenshot on 2.18.

by Sven Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 2009-10-11 at 17:08 +0300, Nikolay Zamosenchuk wrote:

> Good afternoon!
> I'm experiencing some difficulties using 2.18 release.
>
> I'm trying to get window screenshot using such code (working on
> previous major releases, including 2.16):
>
>        GdkWindowObject *private = (GdkWindowObject *)(window);
>        GdkPixmap *internalPixmap = ((GdkWindowPaint
> *)private->paint_stack->data)->pixmap;
>        if (internalPixmap == NULL) {
>                return NULL;
>        }
>        //
>        GdkPixmap *pixmap = gdk_pixmap_new(internalPixmap, width, height, -1);
>        GdkGC *gc = gdk_gc_new(internalPixmap);
>        //
>        gdk_draw_drawable(pixmap, gc, internalPixmap, 0, 0, 0, 0, width, height);
>
> But I get nothing...
> Can anyone help, please?

Poking into internals like this is not supported and can break anytime.
Perhaps you can use gdk_pixbuf_get_from_drawable() instead? Seems to
work find for taking screen-shots and I just verified that it works with
GTK+ 2.18.


Sven


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-devel-list

Re: Get window screenshot on 2.18.

by Danielle Madeley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 2009-10-11 at 16:16 +0200, Sven Neumann wrote:

> Poking into internals like this is not supported and can break anytime.
> Perhaps you can use gdk_pixbuf_get_from_drawable() instead? Seems to
> work find for taking screen-shots and I just verified that it works with
> GTK+ 2.18.

Also have a look at gtk_widget_get_snapshot().

--d

--
Danielle Madeley

Collabora Ltd., Melbourne, Australia
http://www.collabora.co.uk/

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-devel-list