imagedata and alpha byte

Niggemann, Bernd Bernd.Niggemann at uni-wh.de
Wed May 9 14:37:06 EDT 2018


Hi,

please do not use numToChar in version 7.0 and up for image manipulation, use numToByte or byteToNum

NumToChar is deprecated. It might work but is horribly slow.

along the lines of Mike's example

--------------------------
on mouseUp
   local tAlphaData, tTransparent, tHalfTransparent
   local tImgData, tCollect, tLength
   
   put the imageData of image 1 into tImgData
   
   -- not needed here but if you want to modify existing AD
   put the alphaData of image 1 into tAlphaData
   
   put numToByte(0) into tTransparent
   put numToByte(127) into tHalfTransparent
   put the width of image 1 * the height of image 1 into tLength
   
   repeat tLength
      -- put tTransparent after tCollect
      put tHalfTransparent after tCollect
   end repeat
   
   -- in LC 9 you have to set imagedata again explicitly
   set the imageData of image 1 to tImgData
   
   set the alphaData of image 1 to tCollect
end mouseUp
------------

Kind regards
Bernd






More information about the Use-livecode mailing list