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
57 public static int alpha(int color) {
58 return color >>> 24;
62 * Return the red component of a color int. This is the same as saying
63 * (color >> 16) & 0xFF
65 public static int red(int color) {
66 return (color >> 16) & 0xFF;
70 * Return the green component of a color int. This is the same as saying
71 * (color >> 8) & 0xFF
73 public static int green(int color) {
74 return (color >> 8) & 0xFF;
78 * Return the blue component of a color int. This is the same as saying
79 * color & 0xFF
81 public static int blue(int color) {
82 return color & 0xFF;
86 * Return a color-int from red, green, blue components.
90 * returned color is undefined.
91 * @param red Red component [0..255] of the color
92 * @param green Green component [0..255] of the color
93 * @param blue Blue component [0..255] of the color
101 * Return a color-int from alpha, red, green, blue components.
104 * returned color is undefined.
105 * @param alpha Alpha component [0..255] of the color
106 * @param red Red component [0..255] of the color
107 * @param green Green component [0..255] of the color
108 * @param blue Blue component [0..255] of the color
116 * Returns the relative luminance of a color.
123 public static float luminance(@ColorInt int color) {
124 double red = Color.red(color) / 255.0;
126 double green = Color.green(color) / 255.0;
128 double blue = Color.blue(color) / 255.0;
134 * Parse the color string, and return the corresponding color-int.
149 long color = Long.parseLong(colorString.substring(1), 16);
152 color |= 0x00000000ff000000;
154 throw new IllegalArgumentException("Unknown color");
156 return (int)color;
158 Integer color = sColorNameMap.get(colorString.toLowerCase(Locale.ROOT));
159 if (color != null) {
160 return color;
163 throw new IllegalArgumentException("Unknown color");
184 * Convert the argb color to its HSV components.
188 * @param color the argb color to convert. The alpha component is ignored.
191 public static void colorToHSV(@ColorInt int color, @Size(3) float hsv[]) {
192 RGBToHSV((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, hsv);
196 * Convert HSV components to an ARGB color. Alpha set to 0xFF.
202 * @return the resulting argb color
209 * Convert HSV components to an ARGB color. The alpha component is passed
215 * @param alpha the alpha component of the returned argb color.
217 * @return the resulting argb color
230 * Converts an HTML color (named or numeric) to an integer RGB value.
232 * @param color Non-null color string.
234 * @return A color value, or {@code -1} if the color string could not be interpreted.
239 public static int getHtmlColor(String color) {
240 Integer i = sColorNameMap.get(color.toLowerCase(Locale.ROOT));
245 return XmlUtils.convertValueToInt(color, -1);