MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getColor

Method getColor

ij/src/main/java/ij/gui/PointRoi.java:884–903  ·  view source on GitHub ↗
(int index)

Source from the content-addressed store, hash-verified

882 }
883
884 private static Color getColor(int index) {
885 if (colors==null) {
886 colors = new Color[MAX_COUNTERS];
887 colors[0]=Color.yellow; colors[1]=Color.magenta; colors[2]=Color.cyan;
888 colors[3]=Color.orange; colors[4]=Color.green; colors[5]=Color.blue;
889 colors[6]=Color.white; colors[7]=Color.darkGray; colors[8]=Color.pink;
890 colors[9]=Color.lightGray;
891 }
892 if (colors[index]!=null)
893 return colors[index];
894 else {
895 Random ran = new Random();
896 float r = (float)ran.nextDouble();
897 float g = (float)ran.nextDouble();
898 float b = (float)ran.nextDouble();
899 Color c = new Color(r, g, b);
900 colors[index] = c;
901 return c;
902 }
903 }
904
905 /** Returns a point index if it has been at least one second since
906 the last point was added and the specified screen coordinates are

Callers 2

recordMethod · 0.95
drawPointMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected