[comp.windows.x] Problems with XGetImage

dargiro@blackstone.UUCP (Danielle Argiro-S) (12/10/87)

  Hello - 

  I am currently in the process of converting our plot package 
  (written originally under X10.4) to X11.  I am having major
  problems using XGetImage and I was hoping you could help me,
  since I am totally out of ideas.

  Here is the scenario:  I need to get a dump of the displayed
  window in order to enable laser printer capabilities.  Previously,
  I was using XPixmapGetXY and XPixmapGetZ to dump the window information,
  and then I was converting the information (bytes and shorts, respectively)
  into the type I needed (bits).  This worked fine.

  Under X11, in the "X11 diffs" document, it says that if you were using
  XPixmapGetXY or XPixmapGetZ, you should now use XGetImage with the
  format = XYPixmap or format = ZPixmap.

  So this is what I did:

  XImage *window_image;
  int    x, y;
  unsigned int width, height;
  etc.

  here is the call:

  window_image = XGetImage(DSP_str, workspace, x, y, width, height,
                           plane_mask, format);

  where:
         1) DSP_str is the display pointer, the same global one that's used
          everywhere else and works fine.

         2) workspace is the Window that I'm using 
            (also works fine everyplace else)

         3) x and y are ints, both equal to 32.
 
         4) width and height are unsigned ints, both equal to 512.

         5) the plane_mask is tricky.  I've tried 0xffff, AllPlanes,
            1L, 0L, and everything else I could think of.

         6) for format, I've been sending either XYPixmap or ZPixmap

  
    It seems that no matter *what* I do, it comes back with an X ERROR
  message about "mismatched parameters" just before it crashes.  I suspect
  it may well be the plane_mask that is the problem, but I don't know what
  to use!  

    Regardless of whether or not I am sending the proper plane_mask
  for the results I'm expecting, I should at least get the structure
  that I'm asking for (even if the information in it is not quite what I
  had in mind) instead of a crash.


  PLEASE  if you can help me in any way it would be VERY MUCH appreciated!

  ALL our laser-output capabilities hang on this one call.

  thank you *so much* for your time!

  Danielle Argiro - UNM EECE Dept.

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (12/10/87)

    Date: Wed, 9 Dec 87 15:42:25 mst
    From: hi!blackstone!dargiro@hc.dspo.gov (Danielle Argiro-S)

      window_image = XGetImage(DSP_str, workspace, x, y, width, height,
			       plane_mask, format);

      where:
	     3) x and y are ints, both equal to 32.
	     4) width and height are unsigned ints, both equal to 512.
  
	It seems that no matter *what* I do, it comes back with an X ERROR
      message about "mismatched parameters" just before it crashes.

The protocol requires that the requested rectangle be wholly contained
in the window, and fully visible on the screen.  Since I have no idea
what geometry your window has, I can't know for sure, but the "parameter
mismatch" error is consistent with asking for an inappropriate rectangle.
Since you don't say what "it" is that crashes, I can't comment on that
aspect.  If it is the server crashing, please submit a bug report to
xbugs@athena.mit.edu.