AlphaData from RGB

Scott Rossi scott at tactilemedia.com
Fri Jul 30 03:13:40 EDT 2010


Recently, Chipp Walters wrote:

> BTW, do you know if you can set the alphaimage of a new image to an existing
> RGB image without having to do the math (which I already have).

Do you mean alphaData?  If I understand what you're asking, it sounds like
you want to set the alphaData of one image to the imageData of another.  The
only way I know how to do this via the math.

set alphaData of img 2 to tmImageToAlpha(imageData of img 1)

function tmImageToAlpha pData
   put 2 into C
   repeat (length(pData)/4)
      put numToChar(255 - charToNum(char C of pData)) after tAlpha
      add 4 to C
   end repeat
   return tAlpha
end tmImageToAlpha

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design





More information about the Use-livecode mailing list