Lines Matching refs:color

28  * The Color class defines methods for creating and converting color ints.
31 * stored solely in the alpha component, and not in the color components. The
54 * Return the alpha component of a color int. This is the same as saying
55 * color >>> 24
58 public static int alpha(int color) {
59 return color >>> 24;
63 * Return the red component of a color int. This is the same as saying
64 * (color >> 16) & 0xFF
67 public static int red(int color) {
68 return (color >> 16) & 0xFF;
72 * Return the green component of a color int. This is the same as saying
73 * (color >> 8) & 0xFF
76 public static int green(int color) {
77 return (color >> 8) & 0xFF;
81 * Return the blue component of a color int. This is the same as saying
82 * color & 0xFF
85 public static int blue(int color) {
86 return color & 0xFF;
90 * Return a color-int from red, green, blue components.
94 * returned color is undefined.
95 * @param red Red component [0..255] of the color
96 * @param green Green component [0..255] of the color
97 * @param blue Blue component [0..255] of the color
105 * Return a color-int from alpha, red, green, blue components.
108 * returned color is undefined.
109 * @param alpha Alpha component [0..255] of the color
110 * @param red Red component [0..255] of the color
111 * @param green Green component [0..255] of the color
112 * @param blue Blue component [0..255] of the color
120 * Returns the hue component of a color int.
126 public static float hue(@ColorInt int color) {
127 int r = (color >> 16) & 0xFF;
128 int g = (color >> 8) & 0xFF;
129 int b = color & 0xFF;
162 * Returns the saturation component of a color int.
168 public static float saturation(@ColorInt int color) {
169 int r = (color >> 16) & 0xFF;
170 int g = (color >> 8) & 0xFF;
171 int b = color & 0xFF;
189 * Returns the brightness component of a color int.
195 public static float brightness(@ColorInt int color) {
196 int r = (color >> 16) & 0xFF;
197 int g = (color >> 8) & 0xFF;
198 int b = color & 0xFF;
206 * Parse the color string, and return the corresponding color-int.
221 long color = Long.parseLong(colorString.substring(1), 16);
224 color |= 0x00000000ff000000;
226 throw new IllegalArgumentException("Unknown color");
228 return (int)color;
230 Integer color = sColorNameMap.get(colorString.toLowerCase(Locale.ROOT));
231 if (color != null) {
232 return color;
235 throw new IllegalArgumentException("Unknown color");
239 * Convert HSB components to an ARGB color. Alpha set to 0xFF.
245 * @return the resulting argb color
255 * Convert HSB components to an ARGB color. Alpha set to 0xFF.
263 * @return the resulting argb color
285 case 0: // Red is the dominant color
290 case 1: // Green is the dominant color
300 case 3: // Blue is the dominant color
310 case 5: // Red is the dominant color
339 * Convert the argb color to its HSV components.
343 * @param color the argb color to convert. The alpha component is ignored.
346 public static void colorToHSV(@ColorInt int color, @Size(3) float hsv[]) {
347 RGBToHSV((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, hsv);
351 * Convert HSV components to an ARGB color. Alpha set to 0xFF.
357 * @return the resulting argb color
364 * Convert HSV components to an ARGB color. The alpha component is passed
370 * @param alpha the alpha component of the returned argb color.
372 * @return the resulting argb color
385 * Converts an HTML color (named or numeric) to an integer RGB value.
387 * @param color Non-null color string.
389 * @return A color value, or {@code -1} if the color string could not be interpreted.
394 public static int getHtmlColor(String color) {
395 Integer i = sColorNameMap.get(color.toLowerCase(Locale.ROOT));
400 return XmlUtils.convertValueToInt(color, -1);