chao@polya.Stanford.EDU (Chih-Chao Lam) (06/14/89)
How does one use CalcCMask to perform the lasso effect we see in Pixel Paint or Studio/8? IM-V doesn't seem to be very lucid in this particular instance. Thanks, Chih-Chao
oster@dewey.soe.berkeley.edu (David Phillip Oster) (06/15/89)
In article <10012@polya.Stanford.EDU> chao@polya.Stanford.EDU (Chih-Chao Lam) writes: >How does one use CalcCMask to perform the lasso effect we see in Pixel Paint >or Studio/8? IM-V doesn't seem to be very lucid in this particular instance. The goal is to get a 1-bit deep mask, that has 1s only on the bits you want to move. To do the animation lasso: 1.) copy from a pristine image to a offscreen work pixmap. Use a color table that has white and black in the extremes (since the inverse table resides in the GDev, you may need to allocate an off-screen graphic device to get this.) 2.) CopyBits your mask in the correct location to clear the bits you'll be changing. (srcBic mode) 3.) CopyBits your moving image in the correct location, to set the destination colors. (srcOr mode.) (note, this assumes your image has all white (zero) pixels outside the "good" part of the image." 4.) CopyBits the bound box of the old and new position of the image to the screen. This will in one operation erase the old moving image, ans show the new moving image at the updated location. Repeat these steps as the moving image moves. Now, to create 1.) our 1-bit deep mask, 2.) an offscreen pixmap version of the moving image that has only white bits outside the image: save the path of the mouse around the object as a region. clear an offscreen bitmap and pixmap. paint the region black on the bitmap. And the bound box of the region with this bitmap. This creates a bitmap of the moving image that is white everywhere outside the mouse path. It just isn't shrunken yet. Do the CalcCmask. This will tighten the lasso around the image. Now, use this one bit-deep mask, and CopyBits, and the original image to make an offscreen pixmap that has white bits outside the moving images, and color wherever it should. Written in haste. --- David Phillip Oster --"Unix Version 7 was an improvement not Arpa: oster@dewey.soe.berkeley.edu --only over its predeccessors, but also its Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu --successors."