imagedata and alpha byte

Niggemann, Bernd Bernd.Niggemann at
Wed May 9 14:58:05 EDT 2018

Correcting my previous post.

You don't have to set the imageData explicitly. I was confused by vanishing images.

Apparently if you want to set all of the imageData to numToByte(0) or numToByte(256) the image vanishes.

The workaround is to set it to 1 or 255 respectively. This is in LC 9 GM

Kind regards

Here is the corrected script

on mouseUp
   local tAlphaData, tTransparent, tOpaque
   local tCollect, tLength
   -- not needed here but if you want to modify existing AD
   put the alphaData of image 1 into tAlphaData
   put numToByte(1) into tTransparent -- dont set to 0 or image vanishes
   put numToByte(255) into tOpaque -- dont set to 256 or image vanishes
   put the width of image 1 * the height of image 1 into tLength
   repeat tLength
      --put tTransparent after tCollect
      put tOpaque after tCollect
   end repeat
   set the alphaData of image 1 to tCollect
end mouseUp

More information about the use-livecode mailing list