JB,

Thanks, after modifying it so that I could compare apples to apples, I came up with the following function. It tests to between 7-8 times as fast as the original, which is substantial. I'm pretty sure the overhead is in the binaryEncode function, which you only do 4 times, while I call it once for each pixel. Thanks for your help!

For those interested, in the messagebox type:
go URL "http://www.altuit.com/webs/altuit2/RunRev/altMakeTrans.rev";

best,

Chipp

function altMakeTransAlpha pTransColor,pImgData,pAlphaData
  --> pTransColor IS THE COLOR TO MAKE TRANSPARENT
  -->  EX. "255,255,255" IS WHITE
  --> pImgData IS THE IMAGEDATA FROM WHICH THE MASK IS CREATED
  --> pAlphaData IS THE ALPHADATA OF THE ORIGINAL IMAGE
  --> RETURNS THE ALPHADATA TO USE FOR TRANS MASK

  put binaryEncode("C",0) into t0RGB
  put t0RGB into tAlphaTrans

  put binaryEncode("C",item 1 of pTransColor) after t0RGB
  put binaryEncode("C",item 2 of pTransColor) after t0RGB
  put binaryEncode("C",item 3 of pTransColor) after t0RGB

  put 0 into tPos
  repeat forever
    put offset(t0RGB,pImgData,tPos) into t
    if t=0 then
      exit repeat
    else
      add t+3 to tPos
      put tAlphaTrans into char tPos/4 of pAlphaData
    end if
  end repeat

  return pAlphaData

end altMakeTransAlpha

_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to