[comp.sys.apollo] XGetImage

SRFERGU@ERENJ.BITNET (Scott Ferguson) (06/07/90)

If you've got a window and you know all its properties (in X11 I mean),
is there a way to get the image data without doing an XGetImage, which
allocates memory and takes time to copy all the pixels?

I'd like to save a little time by just getting a pointer to the windows
image arrays, and using it.

Thanks,
Scott Ferguson
srfergu@erenj.bitnet

u36009@U2.NCSA.UIUC.EDU (06/09/90)

> If you've got a window and you know all its properties (in X11 I mean),
> is there a way to get the image data without doing an XGetImage, which
> allocates memory and takes time to copy all the pixels?

> I'd like to save a little time by just getting a pointer to the windows
> image arrays, and using it.

> Thanks,
> Scott Ferguson
> srfergu@erenj.bitnet

I think the problem comes from the fact that the X-Window server contains
the pixmap and the only way that the client can get at it is through its
resource id.  In other words, you cannot pass a pointer over the network
to get at the pixmap.  If you want the pixel contents for the drawable, you
must copy them over the (possible) network from the server to the client.
 

 =============================================================================
      Kem Ahlers                 u36009@u2.ncsa.uiuc.edu  (Internet) 
      Caterpillar, Inc. 
      Peoria, IL  USA 

harry@hpcvlx.cv.hp.com (Harry Phinney) (06/09/90)

>> is there a way to get the image data without doing an XGetImage, which
>> allocates memory and takes time to copy all the pixels?
>> Scott Ferguson

> If you want the pixel contents for the drawable, you
> must copy them over the (possible) network from the server to the client.
>      Kem Ahlers                 u36009@u2.ncsa.uiuc.edu  (Internet) 

Kem is correct, with one exception.  In the case that you're running on
the local system, and happen to be running an R4 server and libraries
built to support the MIT-unsupported-hack shared memory extensions, then
you can share pixmap and image data (but not window bits directly) with
the server.  You would still need to have the server do a CopyArea from
the window to a shared memory pixmap before you could access the bits,
and changes clients make to the window will not automatically be
reflected in the pixmap copy.  The general approach would be to create a
shared memory pixmap, CopyArea the window contents into the pixmap, draw
to the pixmap, then CopyArea the pixmap to the window.  You could do
your own multi-buffering by allocating two (or more) shared memory
pixmaps and alternating drawing ops to and CopyAreas from the pixmaps to
the window.

Caveat:  I've never used X on Domain - I've only used it on HP-UX

Harry Phinney   harry@hp-pcd.cv.hp.com