2021-07-24 02:37:17 +00:00
|
|
|
package androidx.core.graphics;
|
|
|
|
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.ColorSpace;
|
|
|
|
import androidx.annotation.ColorInt;
|
|
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
import d0.z.d.m;
|
|
|
|
/* compiled from: Color.kt */
|
|
|
|
public final class ColorKt {
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component1(long j) {
|
|
|
|
return Color.red(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component1(Color color) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(color, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
return color.getComponent(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int component1(@ColorInt int i) {
|
|
|
|
return (i >> 24) & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component2(long j) {
|
|
|
|
return Color.green(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component2(Color color) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(color, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
return color.getComponent(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int component2(@ColorInt int i) {
|
|
|
|
return (i >> 16) & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component3(long j) {
|
|
|
|
return Color.blue(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component3(Color color) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(color, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
return color.getComponent(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int component3(@ColorInt int i) {
|
|
|
|
return (i >> 8) & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component4(long j) {
|
|
|
|
return Color.alpha(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float component4(Color color) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(color, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
return color.getComponent(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int component4(@ColorInt int i) {
|
|
|
|
return i & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final long convertTo(@ColorInt int i, ColorSpace.Named named) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(named, "colorSpace");
|
2021-07-24 02:37:17 +00:00
|
|
|
return Color.convert(i, ColorSpace.get(named));
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final long convertTo(@ColorInt int i, ColorSpace colorSpace) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(colorSpace, "colorSpace");
|
2021-07-24 02:37:17 +00:00
|
|
|
return Color.convert(i, colorSpace);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final long convertTo(long j, ColorSpace.Named named) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(named, "colorSpace");
|
2021-07-24 02:37:17 +00:00
|
|
|
return Color.convert(j, ColorSpace.get(named));
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final long convertTo(long j, ColorSpace colorSpace) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(colorSpace, "colorSpace");
|
2021-07-24 02:37:17 +00:00
|
|
|
return Color.convert(j, colorSpace);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final Color convertTo(Color color, ColorSpace.Named named) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(color, "<this>");
|
|
|
|
m.checkNotNullParameter(named, "colorSpace");
|
2021-07-24 02:37:17 +00:00
|
|
|
Color convert = color.convert(ColorSpace.get(named));
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(convert, "convert(ColorSpace.get(colorSpace))");
|
2021-07-24 02:37:17 +00:00
|
|
|
return convert;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final Color convertTo(Color color, ColorSpace colorSpace) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(color, "<this>");
|
|
|
|
m.checkNotNullParameter(colorSpace, "colorSpace");
|
2021-07-24 02:37:17 +00:00
|
|
|
Color convert = color.convert(colorSpace);
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(convert, "convert(colorSpace)");
|
2021-07-24 02:37:17 +00:00
|
|
|
return convert;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float getAlpha(long j) {
|
|
|
|
return Color.alpha(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int getAlpha(@ColorInt int i) {
|
|
|
|
return (i >> 24) & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float getBlue(long j) {
|
|
|
|
return Color.blue(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int getBlue(@ColorInt int i) {
|
|
|
|
return i & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final ColorSpace getColorSpace(long j) {
|
|
|
|
ColorSpace colorSpace = Color.colorSpace(j);
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(colorSpace, "colorSpace(this)");
|
2021-07-24 02:37:17 +00:00
|
|
|
return colorSpace;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float getGreen(long j) {
|
|
|
|
return Color.green(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int getGreen(@ColorInt int i) {
|
|
|
|
return (i >> 8) & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float getLuminance(@ColorInt int i) {
|
|
|
|
return Color.luminance(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float getLuminance(long j) {
|
|
|
|
return Color.luminance(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final float getRed(long j) {
|
|
|
|
return Color.red(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final int getRed(@ColorInt int i) {
|
|
|
|
return (i >> 16) & 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final boolean isSrgb(long j) {
|
|
|
|
return Color.isSrgb(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final boolean isWideGamut(long j) {
|
|
|
|
return Color.isWideGamut(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final Color plus(Color color, Color color2) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(color, "<this>");
|
|
|
|
m.checkNotNullParameter(color2, "c");
|
2021-07-24 02:37:17 +00:00
|
|
|
Color compositeColors = ColorUtils.compositeColors(color2, color);
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(compositeColors, "compositeColors(c, this)");
|
2021-07-24 02:37:17 +00:00
|
|
|
return compositeColors;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final Color toColor(@ColorInt int i) {
|
|
|
|
Color valueOf = Color.valueOf(i);
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(valueOf, "valueOf(this)");
|
2021-07-24 02:37:17 +00:00
|
|
|
return valueOf;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final Color toColor(long j) {
|
|
|
|
Color valueOf = Color.valueOf(j);
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullExpressionValue(valueOf, "valueOf(this)");
|
2021-07-24 02:37:17 +00:00
|
|
|
return valueOf;
|
|
|
|
}
|
|
|
|
|
|
|
|
@ColorInt
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final int toColorInt(long j) {
|
|
|
|
return Color.toArgb(j);
|
|
|
|
}
|
|
|
|
|
|
|
|
@ColorInt
|
|
|
|
public static final int toColorInt(String str) {
|
2021-09-21 07:33:49 +00:00
|
|
|
m.checkNotNullParameter(str, "<this>");
|
2021-07-24 02:37:17 +00:00
|
|
|
return Color.parseColor(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequiresApi(26)
|
|
|
|
public static final long toColorLong(@ColorInt int i) {
|
|
|
|
return Color.pack(i);
|
|
|
|
}
|
|
|
|
}
|