Image Masks - Completely lost

Ken Ray kray at sonsothunder.com
Thu Dec 29 16:40:47 EST 2005


On 12/29/05 1:32 PM, "Scott Rossi" <scott at tactilemedia.com> wrote:

> In any event, I've been working a lot lately with image/alphaData and with
> Ken Ray's help figured out a little function that can create alphaData from
> a black and white image.

So *that's* what you were working on... :-)

> This "getAlpha" function requires the long ID of a
> source image, and though it is slower than simply reading the alphaData of
> an existing transparent image (several seconds for a large image), it allows
> for the creation of masks where no transparency info is present.
> 
> function getAlpha tImg
>   put imageData of tImg into tData
>   put 1 into N
>   repeat for each char V in tData
>     if N = 2 or ((N - 2) mod 4 = 0) then \
>         put binaryEncode("C",charToNum(V)) after tAlpha
>     add 1 to N
>   end repeat
>   return tAlpha
> end getAlpha
> 
> Execute the following in your message box to try it:
> 
>  go url "http://www.tactilemedia.com/download/getalpha.rev"

Sweet! Nice to be able to create you own alpha masks...


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list