[comp.windows.x] X question

jw@SPAM.ISTC.SRI.COM (Julie Wong) (02/08/89)

Hello,

I have been trying to put up a black and white bit map on an X window
and without any luck.  Could someone help?

I declared an XImage structure of size 16x16.  Set the image data
pointer to an array of bits.  Then used the XPutImage command to put up
the image.  So far I have not been getting anything.

I think my graphics context is declared correctly because I am able to
put up rectangles and text using the XDrawRectangle and XDrawString
commands.  

The workstation I use is a Sun 140.  

Thanks,

Julie


-------------------------------

Segments of the program follows:

--------------------------------

static short icon_bitmap_bits[256]={
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x30, 0x08,
   0x60, 0x0c, 0x80, 0x07, 0x00, 0x03, 0x80, 0x07, 0xc0, 0x0c, 0x60, 0x18,
   0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

  /*create default graphic context for the window*/
  values.function = GXxor;
  values.plane_mask = AllPlanes;
  values.foreground = BlackPixel(dpy,screen);
  values.background = WhitePixel(dpy,screen);
  values.graphics_exposures = 0;

  mask = 0;
  mask |= GCFunction;
  mask |= GCPlaneMask;
  mask |= GCForeground;
  mask |= GCBackground;
  mask |= GCGraphicsExposures;

  gc = XCreateGC(dpy,window,mask,&values);

  /*define the type of image data*/
  icon_image.width = 16;
  icon_image.height = 16;
  icon_image.xoffset = 0;
  icon_image.format = XYBitmap;
  icon_image.data = (char *) icon_bitmap_bits;
  icon_image.byte_order = LSBFirst;
  icon_image.bitmap_unit = 8;
  icon_image.bitmap_bit_order = LSBFirst;
  icon_image.bitmap_pad = 0;
  icon_image.depth = 1;
  icon_image.bytes_per_line = 2;
  icon_image.bits_per_pixel = 1;

  /*put up image on window*/
  XPutImage(dpy,
	    (Drawable) window,
	    gc,
	    &icon_image,
	    0,0,
	    0,0,
	    16,16);

klee@daisy.UUCP (Ken Lee) (02/09/89)

In article <8902080204.AA04728@aalps5> jw@SPAM.ISTC.SRI.COM (Julie Wong) writes:
>I declared an XImage structure of size 16x16.  Set the image data
>pointer to an array of bits.  Then used the XPutImage command to put up
>the image.  So far I have not been getting anything.

There are problems with XPutImage.  I've had trouble drawing small (less
than 64x64) images on some windows (mainly the root window).  The same
programs with larger images and created windows work fine, though.  Using
pixmaps, with XCopyPlane, seems more reliable for small bitmaps.

Good luck.

Ken Lee
-- 
klee@daisy.uucp
Daisy Systems Corp., Interactive Graphics Tools Dept.

shipley@riki.berkeley.edu (Pete Shipley) (08/22/89)

Are Window ID's unique across multiple connections to the same server?

Has anyone extracted the vt100 widget from xterm? Has anyone tried?
Anyone willing to warn me from trying?


Pete Shipley: 
email: shipley@berkeley.edu		Flames:  cimarron@postgres.berkeley.edu 
       uunet!lurnix!shipley or ucbvax!shipley or pyramid!hippo!{ root peter }
Spelling corections: /dev/null                    Quote: "Anger is an energy"

rws@EXPO.LCS.MIT.EDU (08/22/89)

    Are Window ID's unique across multiple connections to the same server?

I'm not clear on exactly what you're asking.  Once a client has terminated
and all of it's resources have been destroyed, a subsequent client can
connect and be given the same resource id space to use.  So no, resource
ids are not unique for all time.  While a client is connected, no other
client will be given the same resource id space, but other clients can
certainly reference the resource ids of that client.