Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!spdcc!m2c!ulowell!masscomp!black From: black@masscomp.UUCP (Sam Black) Newsgroups: comp.windows.x Subject: Re: bitmaps and backgrounds Message-ID: <2442@masscomp.UUCP> Date: Thu, 22-Oct-87 09:53:35 EST Article-I.D.: masscomp.2442 Posted: Thu Oct 22 09:53:35 1987 Date-Received: Sun, 25-Oct-87 09:43:41 EST References: <885@godot.radonc.unc.edu> Reply-To: black@masscomp.UUCP (Sam Black) Organization: MASSCOMP - Westford, Ma Lines: 56 Keywords: sigh Summary: Expires: Sender: Followup-To: Distribution: In article <885@godot.radonc.unc.edu> sherouse@godot.radonc.unc.edu (George W. Sherouse) writes: > >In my fix to XMenu I used a loop over planes to XCopyPlane from the >bitmap to the pixmap. I am still not convinced that that is the best >way to expand a bitmap, but that aside it seems clear to me that a new >function or macro is needed to prevent ongoing transportability >also reiterate the requirement that the Pixmap and Window be of the >same depth. > >... I would propose either XSetWindowBackgroundBitmap >(functionally identical to XSetWindowBackgroundPixmap but taking a >bitmap as an argument and expanding it internally) and/or >XMakePixmapFromBitmap (to standardize the expansion technique) be >added to Xlib. There is really no reason to iterate over planes as Mr. Sherouse describes. For what it's worth: Pixmap XMakePixmapFromBitmap(dpy, bitmap, width, height, depth, fg, bg) Disply *dpy; Pixmap bitmap; /* source pixmap (depth 1) */ int width, height; /* normally same as bitmap dimensione */ int depth; /* normally DefaultDepth(dpy, DefaultScreen(dpy)) */ int fg, bg; /* foreground and background colors */ { GC gc; XGCValues gcv; Pixmap pixmap = XCreatePixmap(dpy, width, height, depth); if (pixmap) { gcv.foreground = fg; gcv.background = bg; gcv.graphics_exposures = 0; gc = XCreateGC(dpy, pixmap, (GCForeground | GCBackground | GCGraphicsExposures), &gcv); XCopyPlane(dpy, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1); XFreeGC(dpy, gc); } return(pixmap); } - sam black -------------------------------------- I'm pink, therefore I'm Spam. ...!{cca,decvax,seismo}!masscomp!black UUCP black%masscomp.uucp@ Internet --------------------------------------