Newsgroups: comp.windows.x
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!dont-send-mail-to-path-lines
From: ekberg@asl.dl.nec.COM (Tom Ekberg)
Subject: Re: NEEDED: Color "OR" operation
Message-ID: <9105151436.AA23345@aslslc16.asl.dl.nec.com>
Sender: daemon@athena.mit.edu (Mr Background)
Organization: The Internet
Date: 15 May 91 14:36:28 GMT
Lines: 24


 > Hi.  I need the ability to specify a color dominance in graphics operations
 > in X.  More or less a graphics "OR" routine.  I need an efficient means
 > of doing this with XPutImage (I DO NOT want to copy back the pixmap section
 > and do the "OR" locally since that would involve multiple transfers, very
 > inefficient).  The situation is this:  I have a bitmap (1 plane pixmap)
 > locally, and I wish to place it onto a server (color or bw) and I want to
 > be able to specify this behavior:
 > 
 > source	dest	result
 > ------	----	------
 > fg		fg	fg
 > fg		bg	fg
 > bg		fg	fg
 > bg		bg	bg

One way to do this is to transfer the bitmap to a 1-bit deep pixmap on the
server via XPutImage, then use XCopyPlane putting the following into the
GContext for XCopyPlane: the foreground/background you want, and the 1-bit
pixmap as the clipping mask.  This will leave the pixels corresponding to 0's
in the pixmap alone and write the foreground for the pixels corresponding to
1's in the pixmap.

  -- tom, ekberg@asl.dl.nec.com (x3503)
