Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!decwrl!sun-barr!newstop!sun!argv From: argv@turnpike.Eng.Sun.COM (Dan Heller) Newsgroups: comp.windows.x.motif Subject: Re: Loading pixmap in drawn button on color display? Message-ID: <141346@sun.Eng.Sun.COM> Date: 27 Aug 90 05:19:06 GMT References: <1990Aug27.005946.5857@elroy.jpl.nasa.gov> Sender: news@sun.Eng.Sun.COM Organization: O'Reilly && Associates Lines: 28 In article <1990Aug27.005946.5857@elroy.jpl.nasa.gov> pjs@aristotle.jpl.nasa.gov writes: > (The bitmaps are from /usr/include/X11/bitmaps and I convert them > to pixmaps with XReadBitmapFile). ... > After a while of scratching my head, it dawned on me that the > problem was in the drawnbutton, and was because the color w/s > ihas an 8-bit deep display. I recall reading something about > this here lately. Anyway, I tried setting the depth resource to > 1 in the argument list in the widget creation call, but that didn't > help. How can I write something which works on mono and color > displays? More to the point, why can't the drawnbutton figure > it out for itself??? It *could* figure this out for itself, but I guess they chose to implement it that it doesn't leaving the responsibility to the programmer. the solution is to 1) read the bitmap file. 2) if DefaultDOfScreenepth() is > 1 a) create a _new_ pixmap that's the *same size* as the bitmap b) Use XCopyPlane() to copy the 1-bit deep pixmap onto the multi-depth pixmap. 3) copy appropriate pixmap as resource value. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.