From 7873b6da5afada5d962b233feb6cc613b526ffb1 Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Wed, 12 Aug 2015 13:12:34 -0400 Subject: [PATCH] Remove framework-private Color.HSBtoColor API Bug: 22815971 Change-Id: Ic4cb43e78e0a7a6fc234865759754d106cef11dc --- graphics/java/android/graphics/Color.java | 83 ----------------------- 1 file changed, 83 deletions(-) diff --git a/graphics/java/android/graphics/Color.java b/graphics/java/android/graphics/Color.java index 666dbd89139fd..23d26eb88108c 100644 --- a/graphics/java/android/graphics/Color.java +++ b/graphics/java/android/graphics/Color.java @@ -235,89 +235,6 @@ public class Color { throw new IllegalArgumentException("Unknown color"); } - /** - * Convert HSB components to an ARGB color. Alpha set to 0xFF. - * hsv[0] is Hue [0 .. 1) - * hsv[1] is Saturation [0...1] - * hsv[2] is Value [0...1] - * If hsv values are out of range, they are pinned. - * @param hsb 3 element array which holds the input HSB components. - * @return the resulting argb color - * - * @hide Pending API council - */ - @ColorInt - public static int HSBtoColor(@Size(3) float[] hsb) { - return HSBtoColor(hsb[0], hsb[1], hsb[2]); - } - - /** - * Convert HSB components to an ARGB color. Alpha set to 0xFF. - * hsv[0] is Hue [0 .. 1) - * hsv[1] is Saturation [0...1] - * hsv[2] is Value [0...1] - * If hsv values are out of range, they are pinned. - * @param h Hue component - * @param s Saturation component - * @param b Brightness component - * @return the resulting argb color - * - * @hide Pending API council - */ - @ColorInt - public static int HSBtoColor(float h, float s, float b) { - h = MathUtils.constrain(h, 0.0f, 1.0f); - s = MathUtils.constrain(s, 0.0f, 1.0f); - b = MathUtils.constrain(b, 0.0f, 1.0f); - - float red = 0.0f; - float green = 0.0f; - float blue = 0.0f; - - final float hf = (h - (int) h) * 6.0f; - final int ihf = (int) hf; - final float f = hf - ihf; - final float pv = b * (1.0f - s); - final float qv = b * (1.0f - s * f); - final float tv = b * (1.0f - s * (1.0f - f)); - - switch (ihf) { - case 0: // Red is the dominant color - red = b; - green = tv; - blue = pv; - break; - case 1: // Green is the dominant color - red = qv; - green = b; - blue = pv; - break; - case 2: - red = pv; - green = b; - blue = tv; - break; - case 3: // Blue is the dominant color - red = pv; - green = qv; - blue = b; - break; - case 4: - red = tv; - green = pv; - blue = b; - break; - case 5: // Red is the dominant color - red = b; - green = pv; - blue = qv; - break; - } - - return 0xFF000000 | (((int) (red * 255.0f)) << 16) | - (((int) (green * 255.0f)) << 8) | ((int) (blue * 255.0f)); - } - /** * Convert RGB components to HSV. * hsv[0] is Hue [0 .. 360)