[comp.windows.x] XCreatePixmapFromBitmapData misusing ....

etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) (10/12/90)

The Athena Label Widget, techincally, only takes BITMAPS and not PIXMAPS.

There is a distinction.  A BITMAP contains 1's and 0's.  A PIXMAP contains
Pixel Values.  When the Athena label widget tries to write out a BITMAP,
it maps 1's and 0's to foreground and background.

You had already permuted these values with XCreatePixmapFromBitmapData.
You should NOT be using this routine for this purpose, you should be
using XCreateBitmapFromData.

The Athena Label widget actually tries it best with a pixmap by testing
its depth.  If depth 1 it assumes a BITMAP, otherwise, it assumes a PIXMAP.

If you were on a multi-plane device, your problem would mysteriously disappear.

--
					Eric Taylor
					Baylor College of Medicine
					etaylor@wilkins.bmc.tmc.edu
					(713) 798-3776

casey@gauss.llnl.gov (Casey Leedom) (10/12/90)

| From: etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor)
| 
| The Athena Label Widget, technically, only takes BITMAPS and not PIXMAPS.

  Thanks!!  That did the trick.  I now have a version of xdbx that works
really well (this was the source of my XCreatePixmapFromBitmapData()
question.)

| There is a distinction.  A BITMAP contains 1's and 0's.  A PIXMAP contains
| Pixel Values.  When the Athena label widget tries to write out a BITMAP,
| it maps 1's and 0's to foreground and background.
| 
| You had already permuted these values with XCreatePixmapFromBitmapData.
| You should NOT be using this routine for this purpose, you should be
| using XCreateBitmapFromData.

  Strangely enough, if you look at the insides of XCreateBitmapFromDate
and XCreatePixmapFromBitmapData you'll see that they both create Pixmaps.
The only real difference between the two of them is that
XCreateBitmapFromDate uses a ZPixmap format XImage and
XCreatePixmapFromBitmapData uses an XYBitmap format XImage.

  Also, if the Label widget is mapping 1 to foreground and 0 to
background, how come it didn't inherit the general foreground and
background of my display (*ReverseVideo:on)?  Or, if it's repermuting the
foreground and background values I passed in to the
XCreatePixmapFromBitmapData call, how come no amount of switching those
inputs would produce a white on black display?  (Unless of course I added
those assignments in to my test program -- which I'm still completely
confused by!)

| The Athena Label widget actually tries it best with a pixmap by testing
| its depth.  If depth 1 it assumes a BITMAP, otherwise, it assumes a PIXMAP.
| 
| If you were on a multi-plane device, your problem would mysteriously disappear.

  They did.  And your fix works quite nicely.  But I'm not sure that your
explanation is correct ...  (Talk about looking a gift horse in the
teeth!!  Really Eric, Thanks!!!)

Casey