This is idomatic code. I use this in image_voodoo more or less:
byte reverse[] = new byte[256];
for (int j=0; j<200; j++){
reverse[j]=(byte)(256-j);
}
ByteLookupTable blut=new ByteLookupTable(0, reverse);
In image_voodoo it looks like:
NEGATIVE_OP = LookupOp.new(ByteLookupTable.new(0,
(0...254).to_a.reverse.to_java(:byte)), nil)
However this breaks in 1.4.0RC1. How do we resolve this? I guess I
will argue since 254 fits in an unsigned byte we should stuff it in
using the same appropriate logic that java does when it casts the
value to a byte. When we were talking about this before I guess we
did not have a reasonable example to show the path. I am thinking
this is probably the common example which breaks our assumptions.
This is least-surprise behavior for Java folks too...
-Tom
--
blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email