Mapping Xt/Motif Widgets to an offscreen Pixmap - Motif

This is a discussion on Mapping Xt/Motif Widgets to an offscreen Pixmap - Motif ; I am creating an application that needs to take screenshots of Xt/Motif Widgets that are built on the fly. All I need is an image, so I don't need to map them to a physical display (I'd actually rather avoid ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Mapping Xt/Motif Widgets to an offscreen Pixmap

  1. Mapping Xt/Motif Widgets to an offscreen Pixmap

    I am creating an application that needs to take screenshots of
    Xt/Motif Widgets that are built on the fly. All I need is an image, so
    I don't need to map them to a physical display (I'd actually rather
    avoid that). Ideally I would like Xt/Motif to draw everything into a
    Pixmap that I could then manipulate with Xlib routines to get what I
    need, but I cannot find any way to alter the Drawable associated with
    Xt Widgets.

    Short of tricking Xt into doing that, there are other possibilities
    that I feel achieve the same thing, but may vary in difficulty of
    implementation:

    * Create the shell containing the widget(s) off the visible area of
    the Screen (ie. negative values for x and y, a little investigation got
    XGetImage to return null, however)
    * Create a non-physical Screen on the Display and set the Screen of
    the shell to that, the idea being trick X into thinking it has more
    screens that it really does and the behavior would be like having
    another monitor that is always turned off, the user wouldn't notice
    what I was doing on it.
    * Create another X Server that is not connected to a frame buffer,
    connect Xt to that and the rest of my application to the real display
    and copy images between them.

    I would like to take the route of least resistance, so to speak, I'd
    like to avoid changing the X server configuration if at all possible,
    but if not I am open to that.

    Thanks,
    Aaron Reffett


  2. Re: Mapping Xt/Motif Widgets to an offscreen Pixmap

    The X Printing servers basically implement this - using
    your third idea below.

    My X is currently set up such that a Xprt is started, and
    its identity is fed into the shell environment via
    /etc/profile.d/xprint.sh which initialises $XPSERVERLIST,
    usually to a value such as ":33".

    That is then the display you can connect to in your
    application (apart from your real display, that is), to
    do stuff such as printing.

    The source to Xinvest contains code that does this. See
    http://xinvest.sunsite.dk .

    Danny

    On Mon, 11 Jul 2005 13:25:59 -0700, madgoat wrote:

    > I am creating an application that needs to take screenshots of
    > Xt/Motif Widgets that are built on the fly. All I need is an image, so
    > I don't need to map them to a physical display (I'd actually rather
    > avoid that). Ideally I would like Xt/Motif to draw everything into a
    > Pixmap that I could then manipulate with Xlib routines to get what I
    > need, but I cannot find any way to alter the Drawable associated with
    > Xt Widgets.
    >
    > Short of tricking Xt into doing that, there are other possibilities
    > that I feel achieve the same thing, but may vary in difficulty of
    > implementation:
    >
    > * Create the shell containing the widget(s) off the visible area of
    > the Screen (ie. negative values for x and y, a little investigation got
    > XGetImage to return null, however)
    > * Create a non-physical Screen on the Display and set the Screen of
    > the shell to that, the idea being trick X into thinking it has more
    > screens that it really does and the behavior would be like having
    > another monitor that is always turned off, the user wouldn't notice
    > what I was doing on it.
    > * Create another X Server that is not connected to a frame buffer,
    > connect Xt to that and the rest of my application to the real display
    > and copy images between them.
    >
    > I would like to take the route of least resistance, so to speak, I'd
    > like to avoid changing the X server configuration if at all possible,
    > but if not I am open to that.
    >
    > Thanks,
    > Aaron Reffett


    --
    Danny Backx - danny.backx-at-scarlet.be


+ Reply to Thread