Colorize Objects
My problem is that I need for a graphical output of an algorithm a method to colorize all the objects I have. So I wrote this one here:
int[] next_color = {0x70,0x00,0x00};
private int max_co = 0xF0;
private int next_c = 0x01;
private int step = 0x10;
public Color 开发者_如何转开发getNextColor(){
next_color[next_c%3]%=max_co;
next_color[(next_c++)%3]+=step;
return new Color(next_color[0], next_color[1], next_color[2]);
}
What I was thinking while writing this: I found out that colors under #707070 will appear mostly like black, so it does not make any sense to use them. Also I found out that only steps with greater than 0x10 are (really good) recognized by the eye. But now I have only red and some blue objects arround (when using small amounts of objects) - so it looks a little bit like crap. Is there a good way to generate a new color, which can be good differed from the previous and next one?
HSV/HSL color geometries should be easier to use in such algorithms.
精彩评论