Problem with mask

James Hurley jhurley0305 at sbcglobal.net
Sat Oct 18 17:34:05 EDT 2008


>

> Message: 9
> Date: Fri, 17 Oct 2008 06:57:03 -0700 (PDT)
> From: BNig <niggemann at uni-wh.de>
> Subject: Re: Problem with mask
> To: use-revolution at lists.runrev.com
> Message-ID: <20033834.post at talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
>
> James Hurley wrote:
>>
>> In the past I have always used Freehand to deal with masking of  
>> images.
>
> Hi Jim,
>
> the closest I came to a reasonable mask was
>
> ------------------
> on mouseUp
>     set the paintcompression to "RLE"
>     hide image 1
>     lock screen
>     put the windowid of this stack into tStackWindowID
>     import snapshot from rect  (the rect of image 1) of window
> tStackWindowID
>     show image 1
>     put the id of last image into tSnapshotId
>     put the width  of img 1  into tWidth
>     put the height of img 1  into tHeight
>     -- assuming that white is the background we test for nonwhite  
> in just
>     -- one of the 4 bytes that make up a pixel for speed reasons
>     put the imagedata of image id tSnapshotId into tImageData
>     put tWidth * tHeight * 4 into tLengthImageData
>     put numtochar(0) into tBlock
>     put numtochar(255) into tClear
>     put "" into tAlphaData
>     repeat with i = 3 to tLengthImageData-2 step 4
>         if chartonum (char i of tImageData) = 255 then
>             put tBlock after tAlphaData
>         else
>             put tClear after tAlphaData
>         end if
>     end repeat
>     set the alphadata of image 1 to tAlphaData
>     delete image id tSnapshotId
> end mouseUp
> --------------------
> this works in your stack.
> without the snapshot (see Scott's remarks) I never got it to work with
> `within`.
>
> regards
> Bernd

Bernd,

Thanks for the script. I see your plan, and it works--a little  
pixillation around the edges but it makes sense.


Jim Hurley



More information about the Use-livecode mailing list