Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!exodus!dmaustin From: dmaustin@vivid.sun.com (Darren Austin) Newsgroups: comp.windows.x Subject: Re: HELP needed with BadMatch error Message-ID: Date: 26 Mar 91 22:16:09 GMT References: <1991Mar21.083826.6036@siesoft.co.uk> Sender: news@exodus.Eng.Sun.COM Distribution: comp Organization: Sun Microsystems, Mountain View Lines: 49 In-reply-to: huw@siesoft.co.uk's message of 21 Mar 91 08:38:26 GMT Hi Huw, I tried sending you mail, but I it bounced. In article <1991Mar21.083826.6036@siesoft.co.uk> huw@siesoft.co.uk (Huw Roberts) writes: > The protocol error: > ------------------------------------------------------------------------------- > X Error: BadMatch, invalid parameter attributes > Request Major code 72 () > Request Minor code > ResourceID 0xe00002 > Error Serial #13 > Current Serial #14 > ... > > maskp = XCreatePixmap(display, RootWindowOfScreen(screen), cols, rows, 1); > XPutImage(display, maskp, DefaultGCOfScreen(screen), mask, 0, 0, 0, 0, > cols, rows); > } > ------------------------------------------------------------------------------- > Basically the problem is with the last statement. Note that both the Image > and the Pixmap have depth 1. This is the problem. The pixmap and the image may both be of depth 1, but the DefaultDepth() of the server probably isn't. GC's can only be used with drawables of the same depth that it was created with. The DefaultGCOfScreen() is created with the RootWindow as the drawable (which is of depth DefaultDepth()). Therefore if your DefaultDepth() is something other than 1 (like it would be on a color display), you will get this BadMatch error. Now a solution would be to create your own GC with the pixmap as the drawable like so: gc = XCreateGC(display, pixmap, 0, NULL); This will give you the equivalent of the DefaultGC, except that you can use it with the pixmap. Hope this helps, --Darren -- Darren Austin | Actually, it's a buck and a quarter Windows and Graphics Software | staff, but I'm not going to tell Sun Microsystems, Mountain View | *him* that. dmaustin@sun.com |