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

Method c2hex

ij/src/main/java/ij/util/Tools.java:31–40  ·  view source on GitHub ↗

Converts a Color to an 7 byte hex string starting with '#'.

(Color c)

Source from the content-addressed store, hash-verified

29
30 /** Converts a Color to an 7 byte hex string starting with '#'. */
31 public static String c2hex(Color c) {
32 int i = c.getRGB();
33 char[] buf7 = new char[7];
34 buf7[0] = '#';
35 for (int pos=6; pos>=1; pos--) {
36 buf7[pos] = hexDigits[i&0xf];
37 i >>>= 4;
38 }
39 return new String(buf7);
40 }
41
42 /** Converts a float to an 9 byte hex string starting with '#'. */
43 public static String f2hex(float f) {

Callers 2

savePreferencesMethod · 0.95
drawShapeMethod · 0.95

Calls 1

getRGBMethod · 0.80

Tested by

no test coverage detected