On Wed, 29 Mar 2006, Frank Barknecht wrote:
My GEM patches OTOH have a lot of [unpack $1 $2 $3] constructs. Btw: It would be nice if the GEM color objects would accept lists instead of being forced to [unpack 0 0 0] in front of every colorRGB object.
Someone else implemented that.
It's called GridFlow.
BTW, Jitter has got the same problem, just worse. You've got to pass your list through a messagebox like "aoutline $1, routline $2, goutline $3, boutline $4" if it's for setting the outline colour of some figure, for example.
Encoding RGB color in one float is hard enough, but how to encode RGBA into one float?
Take the RGB value as an integer 0..0xFFFFFF. If it's less than 0x800000, substract 0x1000000. Then multiply by 1<<(alpha-104).
To decode, compute alpha = int(log(abs($1))/log(2)+104). Then divide by 1<<(alpha-104). If it's less than 0, add 0x1000000. That gives you an integer 0..0xFFFFFF which is your RGB triplet.
Sorry, but it's really the easiest way (and almost the only way) to encode 32-bit RGBA in a 32-bit float.
If you want to encode it in 24 bits, use 6+6+6+6 bits, and if you want it to fit in 19 bits (because of Pd's... features) then use 5+5+5+4 or something.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada