Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!aurora!geof From: geof@aurora.com (Geoffrey H. Cooper) Newsgroups: comp.lang.postscript Subject: Re: How to paint a non-rectangular image? Message-ID: <1990Feb13.015937.919@aurora.com> Date: 13 Feb 90 01:59:37 GMT References: <4829@helios.ee.lbl.gov> Reply-To: geof@aurora.UUCP (Geoffrey H. Cooper) Organization: The Aurora Group, Palo Alto, CA Lines: 21 In article <4829@helios.ee.lbl.gov> Jef Poskanzer writes: >I want to do a PostScript image operation with a mask. I do not mean >imagemask -- that paints a 1-bit deep image with 1's getting the >current color and 0's getting left alone. What I want to do is paint >an N-bit image, and have a separate 1-bit mask controlling which parts >of the N-bit image get transferred and which parts get ignored. > >I could do it by lasooing the border of the 1-bit mask and converting >it into a clipping list, but that seems extremely grody. Does anyone >see a better way? That is the only way to do it "right." A simpler and faster technique would work if you happen to know that the background is a particular uniform color. Assuming wlog that the background is white, image the grey level image, then image the clipping bitmap over it, inverted, with currentgray set to white. That will "erase" the image wherever you didn't want it painted. - Geof -- geof@aurora.com / aurora!geof@decwrl.dec.com / geof%aurora.com@decwrl.dec.com