blend Images
paolo mazza
mazzapaolo at libero.it
Sun Sep 22 14:58:01 EDT 2002
This script implements the previous one.
Two images, placed one over the other, are joint/blent together in one
single image. The smaller image is deleted at the end of the process.
The script works but has two problems:
- it is slow
- it takes an incredible amount of ram
Any suggestions to speed the process?
Paolo Mazza
Please be informed that:
The name of the bigger image (on the bottom) must be "imagine1".
The bigger image should have not a transparent background.
on MouseUp
put the ID of the last image into NNN
if there is not image "imagine1" then
answer "There is not image imagine1" with "OK"
exit Mouseup
end if
put the MaskData of image "imagine1" into MascheraData0
put the ImageData of image "imagine1" into ImmagineData0
put the MaskData of image ID NNN into MascheraData2
put the ImageData of image ID NNN into ImmagineData2
put MascheraData0 into MascheraData1
put ImmagineData0 into ImmagineData1
put the width of image "imagine1" into X1
put the height of image "imagine1" into Y1
put the width of image ID NNN into X2
put the height of image ID NNN into Y2
if X2>X1 then exit to top
if Y2>Y1 then exit to top
if the right of image "imagine1" < the right of the last image then
exit to top
if the bottom of image "imagine1" < the bottom of the last image then
exit to top
put the left of image "imagine1" into ORR1
put the left of the last image into ORR2
put ORR2-ORR1 into ORR
if ORR<0 then exit to top
put the top of image "imagine1" into VER1
put the top of the last image into VER2
put VER2-VER1 into VER
if VER<0 then exit to top
put "0" into KY
repeat for Y2
put "0" into KX
repeat for X2
put KX+1 into KX
put ORR+KX+((KY+VER)*X1) into PAR1
put KX+(KY*X2) into PAR2
if chartonum(char PAR2 of MascheraData2) <> "0" then
-- put char PAR2 of MascheraData2 into char PAR1 of MascheraData1
put PAR1*4 into PAR1
put PAR2*4 into PAR2
put char (PAR2-3) to PAR2 of ImmagineData2 into char (PAR1-3) to
PAR1 of ImmagineData1
end if
end repeat
put KY+1 into KY
end repeat
if the number of chars of MascheraData1 is the number of chars of
MascheraData0 and the number of chars of ImmagineData1 is the number of
chars of ImmagineData0 then
set the MaskData of image "imagine1" to MascheraData1
set the ImageData of image "imagine1" to ImmagineData1
end if
delete last image
beep 1
end MouseUp
More information about the use-livecode
mailing list