fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3.  
  4. import android.graphics.Color;
  5. import android.graphics.PointF;
  6. import android.support.annotation.IntRange;
  7.  
  8. import java.util.ArrayList;
  9. import java.util.Arrays;
  10. import java.util.List;
  11.  
  12. import timber.log.Timber;
  13.  
  14.  
  15. public class ColorHelper {
  16.  
  17. private static final int cptRED = 0;
  18. private static final int cptGREEN = 1;
  19. private static final int cptBLUE = 2;
  20.  
  21.  
  22. public static String hsvToRgb(Double hue, Double sat) {
  23. return hsvToRgb(hue, sat, 1.0d);
  24. }
  25.  
  26. public static String hsvToRgb(Double hue, Double sat, Double val) {
  27. Double r = 0.0d;
  28. Double g = 0.0d;
  29. Double b = 0.0d;
  30. Integer i = (int) Math.floor(hue * 6.0d);
  31. Double f = (hue * 6.0d) - ((double) i);
  32. Double p = val * (1.0d - sat);
  33. Double q = val * (1.0d - (f * sat));
  34. Double t = val * (1.0d - (1.0d - f) * sat);
  35. switch (i % 6) {
  36. case 0:
  37. r = val;
  38. g = t;
  39. b = p;
  40. break;
  41. case 1:
  42. r = q;
  43. g = val;
  44. b = p;
  45. break;
  46. case 2:
  47. r = p;
  48. g = val;
  49. b = t;
  50. break;
  51. case 3:
  52. r = p;
  53. g = q;
  54. b = val;
  55. break;
  56. case 4:
  57. r = t;
  58. g = p;
  59. b = val;
  60. break;
  61. case 5:
  62. r = val;
  63. g = p;
  64. b = q;
  65. break;
  66. }
  67. String StringR = Integer.toHexString((int) (r * 255.0d));
  68. String StringG = Integer.toHexString((int) (g * 255.0d));
  69. String StringB = Integer.toHexString((int) (b * 255.0d));
  70. if (StringR.length() == 1) {
  71. StringR = "0" + StringR;
  72. }
  73. if (StringG.length() == 1) {
  74. StringG = "0" + StringG;
  75. }
  76. if (StringB.length() == 1) {
  77. StringB = "0" + StringB;
  78. }
  79. return StringR + StringG + StringB;
  80. }
  81.  
  82.  
  83. public static String ctToRgb(int ct) {
  84. double red;
  85. double green;
  86. double blue;
  87. double temp = (ctToKelvin(ct) + 1000.0d) / 100.0d;
  88. if (temp <= 66.0d) {
  89. red = 255.0d;
  90. } else {
  91. red = 329.698727446d * Math.pow(temp - 60.0d, -0.1332047592d);
  92. if (red < 0.0d) {
  93. red = 0.0d;
  94. }
  95. if (red > 255.0d) {
  96. red = 255.0d;
  97. }
  98. }
  99. if (temp <= 66.0d) {
  100. green = (99.4708025861d * Math.log1p(temp)) - 161.1195681661d;
  101. if (green < 0.0d) {
  102. green = 0.0d;
  103. }
  104. if (green > 255.0d) {
  105. green = 255.0d;
  106. }
  107. } else {
  108. green = 288.1221695283d * Math.pow(temp - 60.0d, -0.0755148492d);
  109. if (green < 0.0d) {
  110. green = 0.0d;
  111. }
  112. if (green > 255.0d) {
  113. green = 255.0d;
  114. }
  115. }
  116. if (temp >= 66.0d) {
  117. blue = 255.0d;
  118. } else if (temp <= 19.0d) {
  119. blue = 0.0d;
  120. } else {
  121. blue = (130.5177312231d * Math.log1p(temp - 10.0d)) - 305.0447927307d;
  122. if (blue < 0.0d) {
  123. blue = 0.0d;
  124. }
  125. if (blue > 255.0d) {
  126. blue = 255.0d;
  127. }
  128. }
  129. String r = Integer.toHexString((int) red);
  130. String g = Integer.toHexString((int) green);
  131. String b = Integer.toHexString((int) blue);
  132. if (r.length() == 1) {
  133. r = "0" + r;
  134. }
  135. if (g.length() == 1) {
  136. g = "0" + g;
  137. }
  138. if (b.length() == 1) {
  139. b = "0" + b;
  140. }
  141. return r + g + b;
  142. }
  143.  
  144. public static int ctToKelvin(int ct) {
  145. return clamp(1000000 / ct, 2000, 6500);
  146. }
  147.  
  148. public static int kelvinToCt(int kelvin) {
  149. return clamp(1000000 / kelvin, 153, 500);
  150. }
  151.  
  152.  
  153. public static int ctToColor(int ct) {
  154. String hex = "#" + ctToRgb(ct);
  155. return Color.parseColor(hex);
  156. }
  157.  
  158.  
  159. /**
  160.   * Checks whether the specified value is between (including bounds) 0 and 255
  161.   *
  162.   * @param colorValue Color value
  163.   * @return Specified input value if between 0 and 255, otherwise 0
  164.   */
  165. public static int assertColorValueInRange(@IntRange(from = 0, to = 255) int colorValue) {
  166. return ((0 <= colorValue) && (colorValue <= 255)) ? colorValue : 0;
  167. }
  168.  
  169. /**
  170.   * Formats individual RGB values to be output as a HEX string.
  171.   * <p>
  172.   * Beware: If color value is lower than 0 or higher than 255, it's reset to 0.
  173.   *
  174.   * @param red Red color value
  175.   * @param green Green color value
  176.   * @param blue Blue color value
  177.   * @return HEX String containing the three values
  178.   */
  179. public static String formatColorValues(
  180. @IntRange(from = 0, to = 255) int red,
  181. @IntRange(from = 0, to = 255) int green,
  182. @IntRange(from = 0, to = 255) int blue) {
  183.  
  184. return String.format("%02X%02X%02X",
  185. assertColorValueInRange(red),
  186. assertColorValueInRange(green),
  187. assertColorValueInRange(blue)
  188. );
  189. }
  190.  
  191. public static String formatColorValues(int color, boolean alpha) {
  192. return String.format("%06X", (0xFFFFFF & color));
  193. }
  194.  
  195.  
  196. /**
  197.   * Formats individual ARGB values to be output as an 8 character HEX string.
  198.   * <p>
  199.   * Beware: If any value is lower than 0 or higher than 255, it's reset to 0.
  200.   *
  201.   * @param alpha Alpha value
  202.   * @param red Red color value
  203.   * @param green Green color value
  204.   * @param blue Blue color value
  205.   * @return HEX String containing the three values
  206.   * @since v1.1.0
  207.   */
  208. public static String formatColorValues(
  209. @IntRange(from = 0, to = 255) int alpha,
  210. @IntRange(from = 0, to = 255) int red,
  211. @IntRange(from = 0, to = 255) int green,
  212. @IntRange(from = 0, to = 255) int blue) {
  213.  
  214. return String.format("%02X%02X%02X%02X",
  215. assertColorValueInRange(alpha),
  216. assertColorValueInRange(red),
  217. assertColorValueInRange(green),
  218. assertColorValueInRange(blue)
  219. );
  220. }
  221.  
  222.  
  223. public static double[] calculateFFT(byte[] signal) {
  224. final int mNumberOfFFTPoints = 1024;
  225. double mMaxFFTSample;
  226. double temp;
  227. Complex[] y;
  228. Complex[] complexSignal = new Complex[mNumberOfFFTPoints];
  229. double[] absSignal = new double[mNumberOfFFTPoints / 2];
  230.  
  231. for (int i = 0; i < mNumberOfFFTPoints; i++) {
  232. temp = (double) ((signal[2 * i] & 0xFF) | (signal[2 * i + 1] << 8)) / 32768.0F;
  233. complexSignal[i] = new Complex(temp, 0.0);
  234. }
  235.  
  236. y = FFT.INSTANCE.fft(complexSignal);
  237.  
  238. mMaxFFTSample = 0.0;
  239. for (int i = 0; i < (mNumberOfFFTPoints / 2); i++) {
  240. absSignal[i] = Math.sqrt(Math.pow(y[i].re(), 2) + Math.pow(y[i].im(), 2));
  241. if (absSignal[i] > mMaxFFTSample) {
  242. mMaxFFTSample = absSignal[i];
  243. }
  244. }
  245.  
  246. return absSignal;
  247.  
  248. }
  249.  
  250.  
  251. public static List<Integer> calculateColorsFromFFT(double[] data, int RECORDER_SAMPLERATE) {
  252. List<Integer> numbers = new ArrayList<>();
  253. double maxDouble = 0.0;
  254. for (Double d : data) {
  255. if (d * RECORDER_SAMPLERATE > maxDouble) {
  256. maxDouble = d;
  257. }
  258. Double t = d * RECORDER_SAMPLERATE;
  259. if (t.intValue() < 65535)
  260. numbers.add(t.intValue());
  261.  
  262. }
  263.  
  264.  
  265. return numbers;
  266. }
  267.  
  268. public static int xyToTemperature(PointF xy) {
  269. float x = xy.x;
  270. float y = xy.y;
  271.  
  272.  
  273. double temp2 = (437 * Math.pow((x - 0.332) / (0.1858 - y), 3) +
  274. 3601 * Math.pow((x - 0.332) / (0.1858 - y), 2) +
  275. 6831 * ((x - 0.332) / (0.1858 - y))) +
  276. 5517;
  277.  
  278. float micro2 = (float) (1 / temp2 * 1000000);
  279. return clamp((int) micro2, 153, 500);
  280. }
  281.  
  282. static public int colorFromXY(PointF xy, String model) {
  283. List<PointF> colorPoints = colorPointsForModel(model);
  284. boolean inReachOfLamps = checkPointInLampsReach(xy, colorPoints);
  285.  
  286. Timber.e("Color was not in reach of lamps");
  287.  
  288. if (!inReachOfLamps) {
  289. // It seems the colour is out of reach; let's find the closest colour we can produce with our lamp and
  290. // send this XY value out.
  291.  
  292. // Find the closest point on each line in the triangle
  293. PointF pAB = getClosestPointToPoints(colorPoints.get(cptRED), colorPoints.get(cptGREEN), xy);
  294. PointF pAC = getClosestPointToPoints(colorPoints.get(cptBLUE), colorPoints.get(cptRED), xy);
  295. PointF pBC = getClosestPointToPoints(colorPoints.get(cptGREEN), colorPoints.get(cptBLUE), xy);
  296.  
  297. // Get the distances per point and see which point is closer to our Point
  298. float dAB = getDistanceBetweenTwoPoints(xy, pAB);
  299. float dAC = getDistanceBetweenTwoPoints(xy, pAC);
  300. float dBC = getDistanceBetweenTwoPoints(xy, pBC);
  301.  
  302. float lowest = dAB;
  303. PointF closestPoint = pAB;
  304.  
  305. if (dAC < lowest) {
  306. lowest = dAC;
  307. closestPoint = pAC;
  308. }
  309. if (dBC < lowest) {
  310. closestPoint = pBC;
  311. }
  312.  
  313. // Change the xy value to a value which is within the reach of the lamp
  314. xy.x = closestPoint.x;
  315. xy.y = closestPoint.y;
  316. }
  317.  
  318. float x = xy.x;
  319. float y = xy.y;
  320. float z = 1.0f - x - y;
  321.  
  322. float Y = 1.0f;
  323. float X = (Y / y) * x;
  324. float Z = (Y / y) * z;
  325.  
  326. // sRGB D65 conversion
  327. float r = X * 3.2406f - Y * 1.5372f - Z * 0.4986f;
  328. float g = -X * 0.9689f + Y * 1.8758f + Z * 0.0415f;
  329. float b = X * 0.0557f - Y * 0.2040f + Z * 1.0570f;
  330.  
  331. if (r > b && r > g && r > 1.0f) {
  332. // red is too big
  333. g = g / r;
  334. b = b / r;
  335. r = 1.0f;
  336. } else if (g > b && g > r && g > 1.0f) {
  337. // green is too big
  338. r = r / g;
  339. b = b / g;
  340. g = 1.0f;
  341. } else if (b > r && b > g && b > 1.0f) {
  342. // blue is too big
  343. r = r / b;
  344. g = g / b;
  345. b = 1.0f;
  346. }
  347.  
  348. // Apply gamma correction
  349. r = r <= 0.0031308f ? 12.92f * r : (1.0f + 0.055f) * (float) Math.pow((double) r, (double) ((1.0f / 2.4f))) - 0.055f;
  350. g = g <= 0.0031308f ? 12.92f * g : (1.0f + 0.055f) * (float) Math.pow((double) g, (double) ((1.0f / 2.4f))) - 0.055f;
  351. b = b <= 0.0031308f ? 12.92f * b : (1.0f + 0.055f) * (float) Math.pow((double) b, (double) ((1.0f / 2.4f))) - 0.055f;
  352.  
  353. if (r > b && r > g) {
  354. // red is biggest
  355. if (r > 1.0f) {
  356. g = g / r;
  357. b = b / r;
  358. r = 1.0f;
  359. }
  360. } else if (g > b && g > r) {
  361. // green is biggest
  362. if (g > 1.0f) {
  363. r = r / g;
  364. b = b / g;
  365. g = 1.0f;
  366. }
  367. } else if (b > r && b > g) {
  368. // blue is biggest
  369. if (b > 1.0f) {
  370. r = r / b;
  371. g = g / b;
  372. b = 1.0f;
  373. }
  374. }
  375.  
  376. return fromFloatRGB(r, g, b);
  377. }
  378.  
  379. static public PointF calculateXY(int color, String model) {
  380. return calculateXY(Color.red(color), Color.green(color), Color.blue(color), model);
  381. }
  382.  
  383. static public PointF calculateXY(int aRed, int aGreen, int aBlue, String model) {
  384. double normalizedRed = (double) aRed / 255.0;
  385. double normalizedGreen = (double) aGreen / 255.0;
  386. double normalizedBlue = (double) aBlue / 255.0;
  387.  
  388. // apply gamma correction
  389. float red = (normalizedRed > 0.04045f) ? (float) Math.pow((normalizedRed + 0.055) / (1.0 + 0.055), 2.4) : (float) (normalizedRed / 12.92);
  390. float green = (normalizedGreen > 0.04045) ? (float) Math.pow((normalizedGreen + 0.055) / (1.0 + 0.055), 2.4) : (float) (normalizedGreen / 12.92);
  391. float blue = (normalizedBlue > 0.04045) ? (float) Math.pow((normalizedBlue + 0.055) / (1.0 + 0.055), 2.4) : (float) (normalizedBlue / 12.92);
  392.  
  393. // wide gamut conversion D65
  394. float X = (red * 0.649926f + green * 0.103455f + blue * 0.197109f);
  395. float Y = (red * 0.234327f + green * 0.743075f + blue * 0.022598f);
  396. float Z = (red * 0.0000000f + green * 0.053077f + blue * 1.035763f);
  397.  
  398. float cx = X / (X + Y + Z);
  399. float cy = Y / (X + Y + Z);
  400.  
  401.  
  402. PointF xyPoint = new PointF(cx, cy);
  403. List<PointF> colorPoints = colorPointsForModel(model);
  404. boolean inReachOfLamps = checkPointInLampsReach(xyPoint, colorPointsForModel(model));
  405.  
  406. if (!inReachOfLamps) {
  407. // It seems the colour is out of reach let's find the closest colour we can produce with our lamp and
  408. // send this XY value out
  409.  
  410. // Find the closest point on each line in the triangle
  411. PointF pAB = getClosestPointToPoints(colorPoints.get(cptRED), colorPoints.get(cptGREEN), xyPoint);
  412. PointF pAC = getClosestPointToPoints(colorPoints.get(cptBLUE), colorPoints.get(cptRED), xyPoint);
  413. PointF pBC = getClosestPointToPoints(colorPoints.get(cptGREEN), colorPoints.get(cptBLUE), xyPoint);
  414.  
  415. // Get the distances per point and see which point is closer to our Point
  416. float dAB = getDistanceBetweenTwoPoints(xyPoint, pAB);
  417. float dAC = getDistanceBetweenTwoPoints(xyPoint, pAC);
  418. float dBC = getDistanceBetweenTwoPoints(xyPoint, pBC);
  419.  
  420. float lowest = dAB;
  421. PointF closestPoint = pAB;
  422.  
  423. if (dAC < lowest) {
  424. lowest = dAC;
  425. closestPoint = pAC;
  426. }
  427. if (dBC < lowest) {
  428. closestPoint = pBC;
  429. }
  430.  
  431. // Change the xy value to a value which is within reach of the lamp
  432. cx = closestPoint.x;
  433. cy = closestPoint.y;
  434. }
  435.  
  436. return new PointF(cx, cy);
  437. }
  438.  
  439. static public List<PointF> colorPointsForModel(String model) {
  440. List<PointF> colorPoints = new ArrayList<PointF>();
  441.  
  442. List<String> hueBulbs = Arrays.asList(
  443. "LCT001", // Hue A19
  444. "LCT002", // Hue BR30
  445. "LCT003" // Hue GU10
  446. );
  447. List<String> livingColors = Arrays.asList(
  448. "LLC001", // Monet, Renoir, Mondriaan (gen II)
  449. "LLC005", // Bloom (gen II)
  450. "LLC006", // Iris (gen III)
  451. "LLC007", // Bloom, Aura (gen III)
  452. "LLC011", // Hue Bloom
  453. "LLC012", // Hue Bloom
  454. "LLC013", // Storylight
  455. "LST001" // Light Strips
  456. );
  457.  
  458. if (hueBulbs.contains(model)) {
  459. // Hue bulbs color gamut triangle
  460. colorPoints.add(new PointF(0.674f, 0.322f)); // Red
  461. colorPoints.add(new PointF(0.408f, 0.517f)); // Green
  462. colorPoints.add(new PointF(0.168f, 0.041f)); // Blue
  463. } else if (livingColors.contains(model)) {
  464. // LivingColors color gamut triangle
  465. colorPoints.add(new PointF(0.703f, 0.296f)); // Red
  466. colorPoints.add(new PointF(0.214f, 0.709f)); // Green
  467. colorPoints.add(new PointF(0.139f, 0.081f)); // Blue
  468. } else {
  469. // Default construct triangle which contains all values
  470. colorPoints.add(new PointF(1.0f, 0.0f)); // Red
  471. colorPoints.add(new PointF(0.0f, 1.0f)); // Green
  472. colorPoints.add(new PointF(0.0f, 0.0f)); // Blue
  473. }
  474.  
  475. return colorPoints;
  476. }
  477.  
  478. static public PointF getClosestPointToPoints(PointF A, PointF B, PointF P) {
  479. PointF AP = new PointF(P.x - A.x, P.y - A.y);
  480. PointF AB = new PointF(B.x - A.x, B.y - A.y);
  481. float ab2 = AB.x * AB.x + AB.y * AB.y;
  482. float ap_ab = AP.x * AB.x + AP.y * AB.y;
  483.  
  484. float t = ap_ab / ab2;
  485.  
  486. if (t < 0.0f) {
  487. t = 0.0f;
  488. } else if (t > 1.0f) {
  489. t = 1.0f;
  490. }
  491.  
  492. return new PointF(A.x + AB.x * t, A.y + AB.y * t);
  493. }
  494.  
  495. private static float getDistanceBetweenTwoPoints(PointF one, PointF two) {
  496. float dx = one.x - two.x; // horizontal difference
  497. float dy = one.y - two.y; // vertical difference
  498. return (float) Math.sqrt(dx * dx + dy * dy);
  499. }
  500.  
  501. private static boolean checkPointInLampsReach(PointF p, List<PointF> colorPoints) {
  502. PointF red = colorPoints.get(cptRED);
  503. PointF green = colorPoints.get(cptGREEN);
  504. PointF blue = colorPoints.get(cptBLUE);
  505.  
  506. PointF v1 = new PointF(green.x - red.x, green.y - red.y);
  507. PointF v2 = new PointF(blue.x - red.x, blue.y - red.y);
  508.  
  509. PointF q = new PointF(p.x - red.x, p.y - red.y);
  510.  
  511. float s = crossProduct(q, v2) / crossProduct(v1, v2);
  512. float t = crossProduct(v1, q) / crossProduct(v1, v2);
  513.  
  514. return (s >= 0.0f) && (t >= 0.0f) && (s + t <= 1.0f);
  515. }
  516.  
  517. private static float crossProduct(PointF p1, PointF p2) {
  518. return (p1.x * p2.y - p1.y * p2.x);
  519. }
  520.  
  521. private static int fromFloatRGB(float red, float green, float blue) {
  522. int r = Math.max((int) Math.ceil(red * 255), 0);
  523. int g = Math.max((int) Math.ceil(green * 255), 0);
  524. int b = Math.max((int) Math.ceil(blue * 255), 0);
  525. return Color.rgb(r, g, b);
  526. }
  527.  
  528. public static int briToAlpha(int bri) {
  529. return (int) (bri / 2.54);
  530. }
  531.  
  532. public static int alphaToBri(int bri) {
  533. return (int) (bri * 2.54);
  534. }
  535.  
  536.  
  537. public static int clamp(int value, int min, int max) {
  538. if (value < min) return min;
  539. if (value > max) return max;
  540. return value;
  541. }
  542.  
  543. public static float clamp(float value, float min, float max) {
  544. if (value < min) return min;
  545. if (value > max) return max;
  546. return value;
  547. }
  548.  
  549. public static int getComplementaryColor(int colorToInvert) {
  550. float[] hsv = new float[3];
  551. Color.RGBToHSV(Color.red(colorToInvert), Color.green(colorToInvert),
  552. Color.blue(colorToInvert), hsv);
  553. hsv[0] = (hsv[0] + 180) % 360;
  554. return Color.HSVToColor(hsv);
  555. }
  556.  
  557. }
  558.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:15: error: class ColorHelper is public, should be declared in a file named ColorHelper.java
public class ColorHelper {
       ^
Main.java:4: error: package android.graphics does not exist
import android.graphics.Color;
                       ^
Main.java:5: error: package android.graphics does not exist
import android.graphics.PointF;
                       ^
Main.java:6: error: package android.support.annotation does not exist
import android.support.annotation.IntRange;
                                 ^
Main.java:12: error: package timber.log does not exist
import timber.log.Timber;
                 ^
Main.java:268: error: cannot find symbol
    public static int xyToTemperature(PointF xy) {
                                      ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:282: error: cannot find symbol
    static public int colorFromXY(PointF xy, String model) {
                                  ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:379: error: cannot find symbol
    static public PointF calculateXY(int color, String model) {
                  ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:383: error: cannot find symbol
    static public PointF calculateXY(int aRed, int aGreen, int aBlue, String model) {
                  ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:439: error: cannot find symbol
    static public List<PointF> colorPointsForModel(String model) {
                       ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:478: error: cannot find symbol
    static public PointF getClosestPointToPoints(PointF A, PointF B, PointF P) {
                                                 ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:478: error: cannot find symbol
    static public PointF getClosestPointToPoints(PointF A, PointF B, PointF P) {
                                                           ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:478: error: cannot find symbol
    static public PointF getClosestPointToPoints(PointF A, PointF B, PointF P) {
                                                                     ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:478: error: cannot find symbol
    static public PointF getClosestPointToPoints(PointF A, PointF B, PointF P) {
                  ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:495: error: cannot find symbol
    private static float getDistanceBetweenTwoPoints(PointF one, PointF two) {
                                                     ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:495: error: cannot find symbol
    private static float getDistanceBetweenTwoPoints(PointF one, PointF two) {
                                                                 ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:501: error: cannot find symbol
    private static boolean checkPointInLampsReach(PointF p, List<PointF> colorPoints) {
                                                  ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:501: error: cannot find symbol
    private static boolean checkPointInLampsReach(PointF p, List<PointF> colorPoints) {
                                                                 ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:517: error: cannot find symbol
    private static float crossProduct(PointF p1, PointF p2) {
                                      ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:517: error: cannot find symbol
    private static float crossProduct(PointF p1, PointF p2) {
                                                 ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:165: error: cannot find symbol
    public static int assertColorValueInRange(@IntRange(from = 0, to = 255) int colorValue) {
                                               ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:180: error: cannot find symbol
            @IntRange(from = 0, to = 255) int red,
             ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:181: error: cannot find symbol
            @IntRange(from = 0, to = 255) int green,
             ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:182: error: cannot find symbol
            @IntRange(from = 0, to = 255) int blue) {
             ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:209: error: cannot find symbol
            @IntRange(from = 0, to = 255) int alpha,
             ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:210: error: cannot find symbol
            @IntRange(from = 0, to = 255) int red,
             ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:211: error: cannot find symbol
            @IntRange(from = 0, to = 255) int green,
             ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:212: error: cannot find symbol
            @IntRange(from = 0, to = 255) int blue) {
             ^
  symbol:   class IntRange
  location: class ColorHelper
Main.java:155: error: cannot find symbol
        return Color.parseColor(hex);
               ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:227: error: cannot find symbol
        Complex[] y;
        ^
  symbol:   class Complex
  location: class ColorHelper
Main.java:228: error: cannot find symbol
        Complex[] complexSignal = new Complex[mNumberOfFFTPoints];
        ^
  symbol:   class Complex
  location: class ColorHelper
Main.java:228: error: cannot find symbol
        Complex[] complexSignal = new Complex[mNumberOfFFTPoints];
                                      ^
  symbol:   class Complex
  location: class ColorHelper
Main.java:233: error: cannot find symbol
            complexSignal[i] = new Complex(temp, 0.0);
                                   ^
  symbol:   class Complex
  location: class ColorHelper
Main.java:236: error: package FFT does not exist
        y = FFT.INSTANCE.fft(complexSignal);
               ^
Main.java:283: error: cannot find symbol
        List<PointF> colorPoints = colorPointsForModel(model);
             ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:286: error: cannot find symbol
        Timber.e("Color was not in reach of lamps");
        ^
  symbol:   variable Timber
  location: class ColorHelper
Main.java:293: error: cannot find symbol
            PointF pAB = getClosestPointToPoints(colorPoints.get(cptRED), colorPoints.get(cptGREEN), xy);
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:294: error: cannot find symbol
            PointF pAC = getClosestPointToPoints(colorPoints.get(cptBLUE), colorPoints.get(cptRED), xy);
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:295: error: cannot find symbol
            PointF pBC = getClosestPointToPoints(colorPoints.get(cptGREEN), colorPoints.get(cptBLUE), xy);
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:303: error: cannot find symbol
            PointF closestPoint = pAB;
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:380: error: cannot find symbol
        return calculateXY(Color.red(color), Color.green(color), Color.blue(color), model);
                           ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:380: error: cannot find symbol
        return calculateXY(Color.red(color), Color.green(color), Color.blue(color), model);
                                             ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:380: error: cannot find symbol
        return calculateXY(Color.red(color), Color.green(color), Color.blue(color), model);
                                                                 ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:402: error: cannot find symbol
        PointF xyPoint = new PointF(cx, cy);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:402: error: cannot find symbol
        PointF xyPoint = new PointF(cx, cy);
                             ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:403: error: cannot find symbol
        List<PointF> colorPoints = colorPointsForModel(model);
             ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:411: error: cannot find symbol
            PointF pAB = getClosestPointToPoints(colorPoints.get(cptRED), colorPoints.get(cptGREEN), xyPoint);
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:412: error: cannot find symbol
            PointF pAC = getClosestPointToPoints(colorPoints.get(cptBLUE), colorPoints.get(cptRED), xyPoint);
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:413: error: cannot find symbol
            PointF pBC = getClosestPointToPoints(colorPoints.get(cptGREEN), colorPoints.get(cptBLUE), xyPoint);
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:421: error: cannot find symbol
            PointF closestPoint = pAB;
            ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:436: error: cannot find symbol
        return new PointF(cx, cy);
                   ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:440: error: cannot find symbol
        List<PointF> colorPoints = new ArrayList<PointF>();
             ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:440: error: cannot find symbol
        List<PointF> colorPoints = new ArrayList<PointF>();
                                                 ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:460: error: cannot find symbol
            colorPoints.add(new PointF(0.674f, 0.322f)); // Red
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:461: error: cannot find symbol
            colorPoints.add(new PointF(0.408f, 0.517f)); // Green
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:462: error: cannot find symbol
            colorPoints.add(new PointF(0.168f, 0.041f)); // Blue
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:465: error: cannot find symbol
            colorPoints.add(new PointF(0.703f, 0.296f)); // Red
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:466: error: cannot find symbol
            colorPoints.add(new PointF(0.214f, 0.709f)); // Green
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:467: error: cannot find symbol
            colorPoints.add(new PointF(0.139f, 0.081f)); // Blue
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:470: error: cannot find symbol
            colorPoints.add(new PointF(1.0f, 0.0f)); // Red
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:471: error: cannot find symbol
            colorPoints.add(new PointF(0.0f, 1.0f)); // Green
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:472: error: cannot find symbol
            colorPoints.add(new PointF(0.0f, 0.0f)); // Blue
                                ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:479: error: cannot find symbol
        PointF AP = new PointF(P.x - A.x, P.y - A.y);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:479: error: cannot find symbol
        PointF AP = new PointF(P.x - A.x, P.y - A.y);
                        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:480: error: cannot find symbol
        PointF AB = new PointF(B.x - A.x, B.y - A.y);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:480: error: cannot find symbol
        PointF AB = new PointF(B.x - A.x, B.y - A.y);
                        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:492: error: cannot find symbol
        return new PointF(A.x + AB.x * t, A.y + AB.y * t);
                   ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:502: error: cannot find symbol
        PointF red = colorPoints.get(cptRED);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:503: error: cannot find symbol
        PointF green = colorPoints.get(cptGREEN);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:504: error: cannot find symbol
        PointF blue = colorPoints.get(cptBLUE);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:506: error: cannot find symbol
        PointF v1 = new PointF(green.x - red.x, green.y - red.y);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:506: error: cannot find symbol
        PointF v1 = new PointF(green.x - red.x, green.y - red.y);
                        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:507: error: cannot find symbol
        PointF v2 = new PointF(blue.x - red.x, blue.y - red.y);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:507: error: cannot find symbol
        PointF v2 = new PointF(blue.x - red.x, blue.y - red.y);
                        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:509: error: cannot find symbol
        PointF q = new PointF(p.x - red.x, p.y - red.y);
        ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:509: error: cannot find symbol
        PointF q = new PointF(p.x - red.x, p.y - red.y);
                       ^
  symbol:   class PointF
  location: class ColorHelper
Main.java:525: error: cannot find symbol
        return Color.rgb(r, g, b);
               ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:551: error: cannot find symbol
        Color.RGBToHSV(Color.red(colorToInvert), Color.green(colorToInvert),
                       ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:551: error: cannot find symbol
        Color.RGBToHSV(Color.red(colorToInvert), Color.green(colorToInvert),
                                                 ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:552: error: cannot find symbol
                Color.blue(colorToInvert), hsv);
                ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:551: error: cannot find symbol
        Color.RGBToHSV(Color.red(colorToInvert), Color.green(colorToInvert),
        ^
  symbol:   variable Color
  location: class ColorHelper
Main.java:554: error: cannot find symbol
        return Color.HSVToColor(hsv);
               ^
  symbol:   variable Color
  location: class ColorHelper
82 errors
stdout
Standard output is empty