|
@@ -1,13 +1,14 @@
|
|
package de.tudarmstadt.informatik.hostage.ui2.helper;
|
|
package de.tudarmstadt.informatik.hostage.ui2.helper;
|
|
|
|
|
|
import android.graphics.Color;
|
|
import android.graphics.Color;
|
|
|
|
+import android.util.Log;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Idea from http://ridiculousfish.com/blog/posts/colors.html
|
|
* Idea from http://ridiculousfish.com/blog/posts/colors.html
|
|
* Created by Fabio Arnold on 25.02.14.
|
|
* Created by Fabio Arnold on 25.02.14.
|
|
*/
|
|
*/
|
|
public class ColorSequenceGenerator {
|
|
public class ColorSequenceGenerator {
|
|
- private static final int BIT_COUNT = 31; // sadly there is no unsigned type in java
|
|
|
|
|
|
+ private static final int BIT_COUNT = 30; // sadly there is no unsigned type in java
|
|
public static int getColorForIndex(int index) {
|
|
public static int getColorForIndex(int index) {
|
|
int reverseIndex = 0;
|
|
int reverseIndex = 0;
|
|
for (int i = 0; i < BIT_COUNT; i++) {
|
|
for (int i = 0; i < BIT_COUNT; i++) {
|
|
@@ -16,7 +17,6 @@ public class ColorSequenceGenerator {
|
|
}
|
|
}
|
|
float hue = ((float)reverseIndex / (float)(1 << BIT_COUNT) + 0.6f) % 1.0f;
|
|
float hue = ((float)reverseIndex / (float)(1 << BIT_COUNT) + 0.6f) % 1.0f;
|
|
|
|
|
|
-
|
|
|
|
float[] hsv = new float[3];
|
|
float[] hsv = new float[3];
|
|
hsv[0] = 360.0f * hue;
|
|
hsv[0] = 360.0f * hue;
|
|
hsv[1] = 0.7f; // not fully saturated
|
|
hsv[1] = 0.7f; // not fully saturated
|