On Tuesday, December 30, 2003, at 10:04 PM, Dar Scott wrote:



So, is this the "transformation" you speak of? Again, how does it work? I
haven't succeeded in making an 8-bit mask from a 32-bit image in Rev. I can
do it very easily in other Mac-only venues, but not here, so far.

This should be a 10 to 20 line function in the simple case. I'll send something later, I'm being called.

Off the top of my head... This may take some fiddling to make work.


-- This function takes an imageData and the r,g,b of the color to be made transparent (key).
-- It returns a value suitable for maskData.
function maskOfImage imageD, r, g, b
local transp, opaq, maskD
put null & numToChar(r) & numToChar(g) & numToChar(b) into colorKey
put null into transp
put numToChar(255) into opaq
put empty into maskD -- not needed
repeat with i= 1 to size(imageD) step 4
if (char i to i+3 of imageD) contains colorKey then -- equals
put transp after maskD
else
put opaq after maskD
end if
end repeat
return maskD
end maskOfImage


Something like that. It might be a byte too long or too short.

I use 'contains' instead of 'is' to avoid consideration of the string as a number. There was a bug in which numbers could start with null and I don't know if the fix got into the latest version. It has an unspecified target milestone. I don't know how to interpret the Bugzilla target milestones, anyway.

Dar Scott



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

Reply via email to