Problem with mask

BNig niggemann at uni-wh.de
Fri Oct 17 09:57:03 EDT 2008



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


-- 
View this message in context: http://www.nabble.com/Problem-with-mask-tp20018648p20033834.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list