@Test public void testGetMaskForColor_ocean() throws Exception { final Color oceanColor = new Color(0, 0, 191); final Color oceanColor1 = colorProvider.getMaskColor("dfgbnzoceankj"); final Color oceanColor2 = colorProvider.getMaskColor("nfujiOCEANcrtvf"); final Color oceanColor3 = colorProvider.getMaskColor("nfujiOceaNcrtvf"); final Color oceanColor4 = colorProvider.getMaskColor("nfujiOCaeNcrtvf"); assertEquals(oceanColor, oceanColor1); assertEquals(oceanColor, oceanColor2); assertEquals(oceanColor, oceanColor3); assertEquals(firstDefaultColour, oceanColor4); }
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);  }