public static List<GradientDrawable> populateHueList() { ArrayList<GradientDrawable> list = new ArrayList<>(); updateDifference(); float delta = (360f / hueDelta) / 2f; for (int i = 0; i < hueDelta; ++i) { // TODO check this math HSVColor hsvColor = new HSVColor( ((hueCenter + i * (360 / hueDelta) - delta) % 360 + 360) % 360, (hueCenter + i * (360 / hueDelta) + delta) % 360, 1f, 1f); int[] values = gradientHelper(hsvColor, 1f, 1f); list.add(new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, values)); } return list; }
public static void setHueRightByPosition(int position) { updateDifference(); float delta = (360f / hueDelta) / 2f; rightHue = (hueCenter + position * (360 / hueDelta) + delta) % 360; }
public static void setHueLeftByPosition(int position) { updateDifference(); float delta = (360f / hueDelta) / 2f; leftHue = ((hueCenter + position * (360 / hueDelta) - delta) % 360 + 360) % 360; }