Quick Demo stack for creating Transpanrecy effect.
jbv
jbv.silences at Club-Internet.fr
Thu May 5 07:05:04 EDT 2005
Chipp,
I was wrong : you can't set transparent pixels using the "replace"
function (actually I thought that the 1st byte of each pixel was used
for the alpha channel, but it's just zero).
But you can try the following script which uses the offset function.
With the image in your example, it's roughly 28 times faster :
on mouseUp
set cursor to watch
lock screen
put binaryEncode("C",0) into a
put a into b
repeat 3 times
put binaryEncode("C",255) after a
end repeat
put imagedata of img 2 into IMD
put alphadata of img 2 into AD
put 0 into sk
repeat forever
put offset(a,IMD,sk) into c
if c=0 then
exit repeat
else
add c+3 to sk
put b into char sk/4 of AD
end if
end repeat
set alphadata of img 2 to AD
end mouseUp
JB
> Chipp,
>
> one more question : have you tried to use the replace function for
> groups
> of 4 bytes in the imagedata to speed up things, instead of checking
> binary values
> in the imagedata and then setting each byte of the alphadata ?
>
> best,
> JB
>
> > Helping out a friend, I did this. It could be good for a number of
> > things including:
> >
> > Creating cursors
> > Creating transparent GIFs
> > etc..
> >
> > in the messagebox:
> >
> > go URL "http://www.altuit.com/webs/altuit2/RunRev/altMakeTrans.rev"
> >
> > altMakeTransparent
> > This is a small demo stack which has a neat function which can make a
> > specific color transparent in an image.
> >
> > The demo makes all white pixels transparent. The function is in the
> > script of the button, "Make White Transparent"
> >
> > -Chipp
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list