Hey all,
Before I submit this I just wanted to check it's not a java nuiance.
The Color class can be used to extract rgb values from a pixel (32 bit int).
I implemented a lookup table filter and used a byte to store each individual
r g & b value to save a bit of space.
Long story short;
public void testColor(){
int nr = (byte)0; // Simulation of lookup in array of byte values
representing individual bands
int ng = (byte)0;
int nb = (byte)0;
int nc = Color.rgb(nr, ng, nb);
assertEquals(nr,Color.red(nc));
assertEquals(ng,Color.green(nc));
assertEquals(ng,Color.blue(nc));
nr = (byte)0;
ng = (byte)137;
nb = (byte)0;
nc = Color.rgb(nr, ng, nb);
assertEquals(nr,Color.red(nc)); // FAIL HERE
assertEquals(ng,Color.green(nc));
assertEquals(nb,Color.blue(nc));
}
Failure in testColor:
junit.framework.AssertionFailedError: expected:<0> but was:<255>
at uk.ac.ic.doc.gea05.miffed.os.ColorTest.testColor(ColorTest.java:44)
Any ideas?
137 is the magic number causing the error in my case, there may be more.
Cheers!
Gav
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---