Images and Image Data

Yennie at aol.com Yennie at aol.com
Fri Jul 5 19:23:01 EDT 2002


While we are still on this thread... (thanks Ken, Scott- cool stuff)...

If you want to use alphaData to adjust the opacity of images, this works real 
fast:

setprop opacity x
  put min(100,x) into x
  put max(1,x) into x
  put the alphaData of me into aData
  replace (char 1 of aData) with binaryEncode("C",(255*x/100)) in aData
  set the alphaData of me to aData
end opacity

Then just say:
## 75% opacity
set the opacity of image "someImage" to 75

DISCLAIMER: don't use this method if you do anything which sets alphaData 
values which vary anywhere within the alphaData. If you do, you can do this, 
which is still faster than building byte-by-byte:

put binaryEncode("C",(255*x/100)) into x
repeat with i=1 to 255
  replace numToChar(i) with x in aData
end repeat

Best Regards,
Brian



More information about the metacard mailing list