home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zephyr.ens.tek.com!uw-beaver!micro-heart-of-gold.mit.edu!bloom-beacon!INTERNET!dont-send-mail-to-path-lines
- From: debbieg@mathworks.UUCP
- Newsgroups: comp.windows.x
- Subject: Blitting through a clipmask
- Message-ID: <9207232018.AA00192@yellowpig.mathworks.com>
- Date: 23 Jul 92 20:18:27 GMT
- Sender: daemon@athena.mit.edu (Mr Background)
- Organization: The Internet
- Lines: 76
-
- Hi,
-
- I'm having a problem with clipmasks and blitting.
- Here's the situation:
-
-
- +-------------------------------------------+
- | |
- | ............ |
- | . . |
- | . . |
- | . . |
- | . . |
- | . . |
- | . . |
- | . . |
- | . +-------+ |
- | . | . | |
- | . | . | |
- | . +-------+ |
- | . . |
- | ............ |
- | |
- | |
- +-------------------------------------------+
-
- The outer box is my window. The dotted ('.') box is the current
- GC clipmask. The small box is the area where I want to blit
- an image.
-
- The image could look something like this:
-
- +--------+
- |xxx/\xxx|
- |xx/ \xx|
- |x/ \x|
- |/ \|
- |\ /|
- |x\ /x|
- |xx\ /xx|
- |xxx\/xxx|
- +--------+
-
- Where x is unknown and the blank part is filled with what I want
- to be displayed on the screen.
- I also have a clipmask set up to look just like the image except
- that the x's are 0's and the blank part is filled with 1's.
-
- How do I blit the image through my clipmask through the GC's
- clipmask onto the screen? I've tried a lot of things and none of
- them seems to work.
- Here is the final way I tried:
- 1) Create a 1 bit blank pixmap and a Screen Depth blank pixmap.
- 2) Create the clipmask image and the data image.
- 3) Do an XPutImage using the window's gc to put the clipmask
- image into the Screen Depth blank pixmap.
- 4) Create a 1 bit gc (its drawable is the 1 bit pixmap)
- with foreground 1 and background 0.
- 5) XCopyPlane the Screen Depth pixmap to the 1 bit blank pixmap.
- 6) Set the window's gc's clipmask to the 1 bit pixmap.
- 7) Set the window's gc's cliporigin to where the image is going
- in the window.
- 8) XPutImage the image into the window.
-
- Somehow, after step 3, the Screen Depth pixmap is still blank (and doesn't
- contain the clipmask ANDed with the window's gc's clipmask like it should)
- no matter what I try setting the clip origin to. When I set the window's
- gc's clipmask to None though, the Screen Depth pixmap contains the whole
- clipmask image.
- How can I get the Screen Depth pixmap to contain the clipmask image ANDed
- with the window's gc's clipmask?????
- Or can anyone tell me a better way to do this whole thing?
-
- Thanx,
- Mike Moretti
- The MathWorks
-