Path: utzoo!attcan!uunet!mailrus!uwm.edu!uakari.primate.wisc.edu!samsung!usc!snorkelwacker!spdcc!xylogics!world!madd From: madd@world.std.com (jim frost) Newsgroups: comp.windows.x Subject: Re: Transparent Pixel values Keywords: Pixmap, Window, Pixels Message-ID: <1989Nov6.214359.15681@world.std.com> Date: 6 Nov 89 21:43:59 GMT References: <809@thor.wright.EDU> <9692@zodiac.ADS.COM> Organization: Software Tool & Die Lines: 32 medmunds@Verity.COM (Mike Edmunds x7645) writes: >In article <809@thor.wright.EDU> ardatta@odin.wright.edu (Arpita Datta) writes: >>How can I copy objects drawn on the Pixmap, onto the window without >>destroying the tiled background of the window ? >I've had some success with setting the clip_mask in a GC to a bitmap >with objects drawn on it, and then painting through this "stencil" >using XFillRectangle over the entire area. Only pixels that were set >in the bitmap are affected in the destination window. If your >original pixmap was more than one plane deep, you'll have to separate >it into components (I keep a separate bitmap for each color) and paint >multiple times. What I've done in the past is to draw the object twice, once on a pixmap in full living color and once on a monochrome pixmap. Make a GC with the clip_mask set to the monochrome pixmap and use XCopyArea to copy the color pixmap through the monochrome mask onto the destination. If you only have a single color to draw, draw on a monochrome pixmap, use that pixmap as clip_mask for the GC, and copy from itself through itself to the destination. This works well on even very complicated "transparent" images, which is why I did it in the first place. Note that this technique has a side-effect; the mask can be used to accomplish picking (ie it's easy to tell if the cursor is on a solid part of a drawn item), something which I have needed in the past and which is generally available on true high-end hardware. Happy hacking, jim frost software tool & die "The World" Public Access Unix for the '90s madd@std.com +1 617-739-WRLD 24hrs {3,12,24}00bps