Loading graphics/java/android/graphics/Color.java +9 −5 Original line number Diff line number Diff line Loading @@ -538,7 +538,7 @@ public class Color { /** * Returns the value of the alpha component in the range \([0..1]\). * Calling this method is equivalent to * <code>getComponent(getComponentCount())</code>. * <code>getComponent(getComponentCount() - 1)</code>. * * @see #red() * @see #green() Loading Loading @@ -690,9 +690,8 @@ public class Color { * Returns the color space encoded in the specified color long. * * @param color The color long whose color space to extract * @return A non-null color space instance. If the color long encodes * an unknown or invalid color space, the {@link ColorSpace.Named#SRGB sRGB} * color space is returned * @return A non-null color space instance * @throws IllegalArgumentException If the encoded color space is invalid or unknown * * @see #red(long) * @see #green(long) Loading Loading @@ -787,6 +786,7 @@ public class Color { * * @param color The color to test * @return True if the color is in the sRGB color space, false otherwise * @throws IllegalArgumentException If the encoded color space is invalid or unknown * * @see #isInColorSpace(long, ColorSpace) * @see #isWideGamut(long) Loading @@ -802,6 +802,7 @@ public class Color { * * @param color The color to test * @return True if the color is in a wide-gamut color space, false otherwise * @throws IllegalArgumentException If the encoded color space is invalid or unknown * * @see #isInColorSpace(long, ColorSpace) * @see #isSrgb(long) Loading Loading @@ -831,6 +832,7 @@ public class Color { * a color space conversion is applied if needed. * * @return An ARGB color in the sRGB color space * @throws IllegalArgumentException If the encoded color space is invalid or unknown */ @ColorInt public static int toArgb(@ColorLong long color) { Loading Loading @@ -873,6 +875,7 @@ public class Color { * * @param color The color long to create a <code>Color</code> from * @return A non-null instance of {@link Color} * @throws IllegalArgumentException If the encoded color space is invalid or unknown */ @NonNull public static Color valueOf(@ColorLong long color) { Loading Loading @@ -1100,6 +1103,7 @@ public class Color { * @param color The color long to convert * @param colorSpace The destination color space * @return A color long in the destination color space * @throws IllegalArgumentException If the encoded color space is invalid or unknown */ @ColorLong public static long convert(@ColorLong long color, @NonNull ColorSpace colorSpace) { Loading Loading @@ -1206,7 +1210,7 @@ public class Color { * @return A value between 0 (darkest black) and 1 (lightest white) * * @throws IllegalArgumentException If the specified color's color space * does not use the {@link ColorSpace.Model#RGB RGB} color model * is unknown or does not use the {@link ColorSpace.Model#RGB RGB} color model */ public static float luminance(@ColorLong long color) { ColorSpace colorSpace = colorSpace(color); Loading graphics/java/android/graphics/ColorSpace.java +6 −4 Original line number Diff line number Diff line Loading @@ -1338,9 +1338,8 @@ public abstract class ColorSpace { } /** * <p>Returns an instance of {@link ColorSpace} whose ID matches the specified * ID. If the ID is < 0 or > {@link #MAX_ID}, calling this method is equivalent * to calling <code>get(Named.SRGB)</code>.</p> * <p>Returns an instance of {@link ColorSpace} whose ID matches the * specified ID.</p> * * <p>This method always returns the same instance for a given ID.</p> * Loading @@ -1348,11 +1347,14 @@ public abstract class ColorSpace { * * @param index An integer ID between {@link #MIN_ID} and {@link #MAX_ID} * @return A non-null {@link ColorSpace} instance * @throws IllegalArgumentException If the ID does not match the ID of one of the * {@link Named named color spaces} */ @NonNull static ColorSpace get(@IntRange(from = MIN_ID, to = MAX_ID) int index) { if (index < 0 || index > Named.values().length) { return get(Named.SRGB); throw new IllegalArgumentException("Invalid ID, must be in the range [0.." + Named.values().length + "]"); } return sNamedColorSpaces[index]; } Loading Loading
graphics/java/android/graphics/Color.java +9 −5 Original line number Diff line number Diff line Loading @@ -538,7 +538,7 @@ public class Color { /** * Returns the value of the alpha component in the range \([0..1]\). * Calling this method is equivalent to * <code>getComponent(getComponentCount())</code>. * <code>getComponent(getComponentCount() - 1)</code>. * * @see #red() * @see #green() Loading Loading @@ -690,9 +690,8 @@ public class Color { * Returns the color space encoded in the specified color long. * * @param color The color long whose color space to extract * @return A non-null color space instance. If the color long encodes * an unknown or invalid color space, the {@link ColorSpace.Named#SRGB sRGB} * color space is returned * @return A non-null color space instance * @throws IllegalArgumentException If the encoded color space is invalid or unknown * * @see #red(long) * @see #green(long) Loading Loading @@ -787,6 +786,7 @@ public class Color { * * @param color The color to test * @return True if the color is in the sRGB color space, false otherwise * @throws IllegalArgumentException If the encoded color space is invalid or unknown * * @see #isInColorSpace(long, ColorSpace) * @see #isWideGamut(long) Loading @@ -802,6 +802,7 @@ public class Color { * * @param color The color to test * @return True if the color is in a wide-gamut color space, false otherwise * @throws IllegalArgumentException If the encoded color space is invalid or unknown * * @see #isInColorSpace(long, ColorSpace) * @see #isSrgb(long) Loading Loading @@ -831,6 +832,7 @@ public class Color { * a color space conversion is applied if needed. * * @return An ARGB color in the sRGB color space * @throws IllegalArgumentException If the encoded color space is invalid or unknown */ @ColorInt public static int toArgb(@ColorLong long color) { Loading Loading @@ -873,6 +875,7 @@ public class Color { * * @param color The color long to create a <code>Color</code> from * @return A non-null instance of {@link Color} * @throws IllegalArgumentException If the encoded color space is invalid or unknown */ @NonNull public static Color valueOf(@ColorLong long color) { Loading Loading @@ -1100,6 +1103,7 @@ public class Color { * @param color The color long to convert * @param colorSpace The destination color space * @return A color long in the destination color space * @throws IllegalArgumentException If the encoded color space is invalid or unknown */ @ColorLong public static long convert(@ColorLong long color, @NonNull ColorSpace colorSpace) { Loading Loading @@ -1206,7 +1210,7 @@ public class Color { * @return A value between 0 (darkest black) and 1 (lightest white) * * @throws IllegalArgumentException If the specified color's color space * does not use the {@link ColorSpace.Model#RGB RGB} color model * is unknown or does not use the {@link ColorSpace.Model#RGB RGB} color model */ public static float luminance(@ColorLong long color) { ColorSpace colorSpace = colorSpace(color); Loading
graphics/java/android/graphics/ColorSpace.java +6 −4 Original line number Diff line number Diff line Loading @@ -1338,9 +1338,8 @@ public abstract class ColorSpace { } /** * <p>Returns an instance of {@link ColorSpace} whose ID matches the specified * ID. If the ID is < 0 or > {@link #MAX_ID}, calling this method is equivalent * to calling <code>get(Named.SRGB)</code>.</p> * <p>Returns an instance of {@link ColorSpace} whose ID matches the * specified ID.</p> * * <p>This method always returns the same instance for a given ID.</p> * Loading @@ -1348,11 +1347,14 @@ public abstract class ColorSpace { * * @param index An integer ID between {@link #MIN_ID} and {@link #MAX_ID} * @return A non-null {@link ColorSpace} instance * @throws IllegalArgumentException If the ID does not match the ID of one of the * {@link Named named color spaces} */ @NonNull static ColorSpace get(@IntRange(from = MIN_ID, to = MAX_ID) int index) { if (index < 0 || index > Named.values().length) { return get(Named.SRGB); throw new IllegalArgumentException("Invalid ID, must be in the range [0.." + Named.values().length + "]"); } return sNamedColorSpaces[index]; } Loading