rick@pcrat.uucp (Rick Richardson) (08/13/90)
Experts: I'm trying to write some text onto a bitmap: uchar image[HT][WID]; Pixmap bm; bm = XCreateBitmapFromData(TheDisplay, XtWindow(PageBox), image, WID*8, HT); XDrawString(TheDisplay, bm, DefaltGC, 10, 10, "SomeText", 8); But I get the following runtime error: X Protocol error: BadMatch, invalid parameter attributes Major opcode of failed request: 74 (X_PolyText8) Minor opcode of failed request: 0 Resource id in failed request: 0x40001a Serial number of failed request: 55 Current serial number in output stream: 56 What's going on? (This is on X11R3). BTW, I tried using XCreatePixmapFromBitmapData, and that worked when depth was set to 4, but failed when depth was set to 1. I wouldn't normally argue with success, but the speed difference between displaying an XCreateBitmap... vs. XCreatePixmap...(depth=4) is considerable, and I only need Black and White. -Rick -- Rick Richardson - PC Research, Inc., uunet!pcrat!rick, (201) 389-8963
mouse@LARRY.MCRCIM.MCGILL.EDU (08/14/90)
> bm = XCreateBitmapFromData(TheDisplay, XtWindow(PageBox), > image, WID*8, HT); > XDrawString(TheDisplay, bm, DefaltGC, 10, 10, "SomeText", 8); > X Protocol error: BadMatch, invalid parameter attributes > Major opcode of failed request: 74 (X_PolyText8) If (as the name implies) Defa[u]ltGC is the default GC of the screen, it's quite possible that its depth does not match bm's depth. Try creating a GC explicitly with XCreateGC to match bm.... der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
garfinke@hpfcda.HP.COM (Dan Garfinkel) (08/15/90)
> bm = XCreateBitmapFromData(TheDisplay, XtWindow(PageBox), > image, WID*8, HT); > XDrawString(TheDisplay, bm, DefaltGC, 10, 10, "SomeText", 8); The problem is the use of DefaultGC. Try creating a GC with bm as the drawable. -Dan