Capture offscreen image - Xwindows

This is a discussion on Capture offscreen image - Xwindows ; Hello. I've read across of the Internet but I didnt find any solution about capturing offscreen window content. I've tried to use XGetImage(), it works fine when the window is wholly visible. But when the window moved to out of ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Capture offscreen image

  1. Capture offscreen image

    Hello.

    I've read across of the Internet but I didnt find any solution about
    capturing offscreen window content.
    I've tried to use XGetImage(), it works fine when the window is wholly
    visible.
    But when the window moved to out of the screen (a part of window still
    visible)
    I have an error during capture.
    I need to capture window content but the window should not be visible.
    Please help.

    --
    Alexander Mitin

  2. Re: Capture offscreen image

    diam@yandex.ru (Alexander Mitin) wrote in
    news:4c6f9351.0406090833.3a2a5afe@posting.google.c om:
    > I've tried to use XGetImage(), it works fine when the window is wholly
    > visible.
    > But when the window moved to out of the screen (a part of window still
    > visible)
    > I have an error during capture.


    Try turning backing store on. Otherwise, the non-visible parts of a window
    are not saved.

    Ken Lee, http://www.rahul.net/kenton/


  3. Re: Capture offscreen image

    Hello.
    Ken Lee wrote in message news:...
    > > I've tried to use XGetImage(), it works fine when the window is wholly

    > Try turning backing store on. Otherwise, the non-visible parts of a window
    > are not saved.

    Thanks a lot for reply. But my task is more complex than I've described.
    I have a sample program written with GTK displaying a window with a button
    and I need to capture this window to image file by clicking that button.
    I've tried to use XGetImage(), but failed. Enabling backing storage has
    no effect (maybe I enable it improperly?). I've found a code snippet at
    http://groups.google.com/groups?hl=e...uli.tte.vtt.fi
    It works really good, but I need a Widget (xlib type) instance for that. So,
    that is the question: how can I obtain the Widget from GTK window?
    I've tried to use the following sequence:
    GTK macros:
    GDK_DISPLAY
    GDK_WINDOW_XWINDOW,
    then XtWindowToWidget()
    But it fails with "Error: Couldn't find per display information"
    Reading docs brings me to conclusion that I cannot obtain Widget instance
    from Window while its on different Display. But my sample is one single process!
    It should work. Where I am wrong? Please help.

  4. Re: Capture offscreen image

    Hello.
    Ken Lee wrote in message news:...
    > > I've tried to use XGetImage(), it works fine when the window is wholly

    > Try turning backing store on. Otherwise, the non-visible parts of a window
    > are not saved.

    Thanks a lot for reply. But my task is more complex than I've described.
    I have a sample program written with GTK displaying a window with a button
    and I need to capture this window to image file by clicking that button.
    I've tried to use XGetImage(), but failed. Enabling backing storage has
    no effect (maybe I enable it improperly?). I've found a code snippet at
    http://groups.google.com/groups?hl=e...uli.tte.vtt.fi
    It works really good, but I need a Widget (xlib type) instance for that. So,
    that is the question: how can I obtain the Widget from GTK window?
    I've tried to use the following sequence:
    GTK macros:
    GDK_DISPLAY
    GDK_WINDOW_XWINDOW,
    then XtWindowToWidget()
    But it fails with "Error: Couldn't find per display information"
    Reading docs brings me to conclusion that I cannot obtain Widget instance
    from Window while its on different Display. But my sample is one single process!
    It should work. Where I am wrong? Please help.

  5. Re: Capture offscreen image

    diam@yandex.ru (Alexander Mitin) wrote in message news:<4c6f9351.0406090833.3a2a5afe@posting.google.com>...

    > I've read across of the Internet but I didnt find any solution about
    > capturing offscreen window content.
    > I've tried to use XGetImage(), it works fine when the window is wholly
    > visible.
    > But when the window moved to out of the screen (a part of window still
    > visible)
    > I have an error during capture.
    > I need to capture window content but the window should not be visible.


    Can't you draw to a pixmap instead of drawing to a window?

    --- Casantos

  6. Re: Capture offscreen image

    Hello.
    > Can't you draw to a pixmap instead of drawing to a window?

    You mean I can somehow force GTK offscreen window to draw itself to given
    compatible pixmap?

    --
    Alexander Mitin

  7. Re: Capture offscreen image

    Alexander Mitin wrote:
    > I've read across of the Internet but I didnt find any solution about
    > capturing offscreen window content.
    > I've tried to use XGetImage(), it works fine when the window is wholly


    What do you want to do exactly ? Print the screen capture ?

    ----

    Bye,
    Roland

    --
    __ . . __
    (o.\ \/ /.o) roland.mainz@nrubsig.org
    \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
    /O /==\ O\ TEL +49 641 7950090
    (;O/ \/ \O

  8. Re: Capture offscreen image

    Hello.
    > > I've tried to use XGetImage(), it works fine when the window is wholly

    > What do you want to do exactly ? Print the screen capture ?


    Get captured the contenst of the GTK window when that window moved out
    of the screen or hidden.
    Let me explain:
    The GTK application raises a window which screen coordinates
    are out of the screen (please dont ask me why ).
    My code in the SAME application should capture the contents of that window
    (i.e. make the screenshot) and put it into png file.

    --
    Alexander Mitin

+ Reply to Thread