@Test public void testGetMaskForColor_ice() throws Exception { final Color iceColor = new Color(191, 255, 255); final Color iceColor1 = colorProvider.getMaskColor("dfgbnicenkj"); final Color iceColor2 = colorProvider.getMaskColor("nfujiICEcrtvf"); final Color iceColor3 = colorProvider.getMaskColor("nfujiicEcrtvf"); final Color iceColor4 = colorProvider.getMaskColor("nfujiEcIcrtvf"); assertEquals(iceColor, iceColor1); assertEquals(iceColor, iceColor2); assertEquals(iceColor, iceColor3); assertEquals(firstDefaultColour, iceColor4); }
public Color getMaskColor(String maskName) { Color color = getPredefinedColor(maskName); while (color == null) { int redStep = 0; int greenStep = 0; int blueStep = 0; double stepSize = 255.0; while (redStep % 2 == 0 && greenStep % 2 == 0 && blueStep % 2 == 0) { updateDivision(); stepSize = 255.0 / (numberOfIntermediateSamplePoints + 1); redStep = (colourCounter / (numberOfTotalSamplePoints * numberOfTotalSamplePoints)) % numberOfTotalSamplePoints; greenStep = (colourCounter / numberOfTotalSamplePoints) % numberOfTotalSamplePoints; blueStep = colourCounter % numberOfTotalSamplePoints; colourCounter++; } final Color candidateColor = new Color((int) (redStep * stepSize), (int) (greenStep * stepSize), (int) (blueStep * stepSize)); if (!isPredefinedColor(candidateColor)) { color = candidateColor; } } return color; }
ColorProvider { public Color getMaskColor(String maskName) { Color color = getPredefinedColor(maskName); while (color == null) { int redStep = 0; int greenStep = 0; int blueStep = 0; double stepSize = 255.0; while (redStep % 2 == 0 && greenStep % 2 == 0 && blueStep % 2 == 0) { updateDivision(); stepSize = 255.0 / (numberOfIntermediateSamplePoints + 1); redStep = (colourCounter / (numberOfTotalSamplePoints * numberOfTotalSamplePoints)) % numberOfTotalSamplePoints; greenStep = (colourCounter / numberOfTotalSamplePoints) % numberOfTotalSamplePoints; blueStep = colourCounter % numberOfTotalSamplePoints; colourCounter++; } final Color candidateColor = new Color((int) (redStep * stepSize), (int) (greenStep * stepSize), (int) (blueStep * stepSize)); if (!isPredefinedColor(candidateColor)) { color = candidateColor; } } return color; } }
ColorProvider { public Color getMaskColor(String maskName) { Color color = getPredefinedColor(maskName); while (color == null) { int redStep = 0; int greenStep = 0; int blueStep = 0; double stepSize = 255.0; while (redStep % 2 == 0 && greenStep % 2 == 0 && blueStep % 2 == 0) { updateDivision(); stepSize = 255.0 / (numberOfIntermediateSamplePoints + 1); redStep = (colourCounter / (numberOfTotalSamplePoints * numberOfTotalSamplePoints)) % numberOfTotalSamplePoints; greenStep = (colourCounter / numberOfTotalSamplePoints) % numberOfTotalSamplePoints; blueStep = colourCounter % numberOfTotalSamplePoints; colourCounter++; } final Color candidateColor = new Color((int) (redStep * stepSize), (int) (greenStep * stepSize), (int) (blueStep * stepSize)); if (!isPredefinedColor(candidateColor)) { color = candidateColor; } } return color; } ColorProvider(); }
ColorProvider { public Color getMaskColor(String maskName) { Color color = getPredefinedColor(maskName); while (color == null) { int redStep = 0; int greenStep = 0; int blueStep = 0; double stepSize = 255.0; while (redStep % 2 == 0 && greenStep % 2 == 0 && blueStep % 2 == 0) { updateDivision(); stepSize = 255.0 / (numberOfIntermediateSamplePoints + 1); redStep = (colourCounter / (numberOfTotalSamplePoints * numberOfTotalSamplePoints)) % numberOfTotalSamplePoints; greenStep = (colourCounter / numberOfTotalSamplePoints) % numberOfTotalSamplePoints; blueStep = colourCounter % numberOfTotalSamplePoints; colourCounter++; } final Color candidateColor = new Color((int) (redStep * stepSize), (int) (greenStep * stepSize), (int) (blueStep * stepSize)); if (!isPredefinedColor(candidateColor)) { color = candidateColor; } } return color; } ColorProvider(); Color getMaskColor(String maskName); }
ColorProvider { public Color getMaskColor(String maskName) { Color color = getPredefinedColor(maskName); while (color == null) { int redStep = 0; int greenStep = 0; int blueStep = 0; double stepSize = 255.0; while (redStep % 2 == 0 && greenStep % 2 == 0 && blueStep % 2 == 0) { updateDivision(); stepSize = 255.0 / (numberOfIntermediateSamplePoints + 1); redStep = (colourCounter / (numberOfTotalSamplePoints * numberOfTotalSamplePoints)) % numberOfTotalSamplePoints; greenStep = (colourCounter / numberOfTotalSamplePoints) % numberOfTotalSamplePoints; blueStep = colourCounter % numberOfTotalSamplePoints; colourCounter++; } final Color candidateColor = new Color((int) (redStep * stepSize), (int) (greenStep * stepSize), (int) (blueStep * stepSize)); if (!isPredefinedColor(candidateColor)) { color = candidateColor; } } return color; } ColorProvider(); Color getMaskColor(String maskName);  }