Problem with mask

Scott Rossi scott at tactilemedia.com
Mon Oct 20 02:51:23 EDT 2008


Recently, James Hurley wrote:

>>> In the past I have always used Freehand to deal with masking of
>>> images.
>>> 
>>> But I thought I would see if I couldn't roll one of my own in RR.
>>> 
>>> It worked after a fashion but is rough around the edges.
>>> ...

>> I think what you're running into is antialiasing -- the smoothing
>> of the edge of the mask graphic.
>> ...
>> Your script appears to work only in values of black and white
>> (block and clear).  If you want to achieve and antialiased edge
>> you need to include in-between (grey) values as well.

> I'm afraid I still don't understand why I got those flat edges.

Is it possible your script finds positions that fall a bit outside the
dimensions of the oval?


>> If you really want to mask an image directly, I think the fastest
>> way to do this is to group the oval in a 0 margins group, import a
>> snapshot image of the group, and store the alphaData of the
>> snapshot in a variable to use as a mask on the target image.
>> ...

> I think I see what you mean here but I'm missing something. I tried
> the following script and got gibberish.

Yes, I messed up -- I should have said snapshot the graphic within the
group, not the group itself.

 import snapshot from rect (rect of grc "myoval") of grc "myoval"

Also, for the above to work, the target image must be in PNG format so that
it can support alphaData (one way to convert an image to PNG in Rev is to
import a snapshot of the image).


> I think I need to see this in a script if I am to understand the process.

I updated the "masked abe" stack to illustrate step by step how to mask an
image via snapshot/script.  Anyone should be able to use this.
In your message box:

  go url "http://www.tactilemedia.com/site_files/downloads/masked_abe.rev"

Both techniques are flexible -- you can use any shape graphic as the source
shape for the mask -- but the 2nd technique allows you to use any object as
mask, not just a graphic.


> These are clearly superior to what I was getting, but I'm trying to
> understand where I went wrong.

I'm sure there's a logical explanation, but I'm more of the mindset that if
it doesn't work one way, figure out another way, get back to work, and ask
questions later. :-)

Hope this helps.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list