114 lines
4.6 KiB
Java
114 lines
4.6 KiB
Java
package androidx.core.graphics;
|
|
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.ColorSpace;
|
|
import android.graphics.Point;
|
|
import android.graphics.PointF;
|
|
import androidx.annotation.ColorInt;
|
|
import androidx.annotation.RequiresApi;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: Bitmap.kt */
|
|
public final class BitmapKt {
|
|
public static final Bitmap applyCanvas(Bitmap bitmap, Function1<? super Canvas, Unit> function1) {
|
|
m.checkNotNullParameter(bitmap, "<this>");
|
|
m.checkNotNullParameter(function1, "block");
|
|
function1.invoke(new Canvas(bitmap));
|
|
return bitmap;
|
|
}
|
|
|
|
public static final boolean contains(Bitmap bitmap, Point point) {
|
|
int i;
|
|
m.checkNotNullParameter(bitmap, "<this>");
|
|
m.checkNotNullParameter(point, "p");
|
|
int i2 = point.x;
|
|
return i2 >= 0 && i2 < bitmap.getWidth() && (i = point.y) >= 0 && i < bitmap.getHeight();
|
|
}
|
|
|
|
public static final boolean contains(Bitmap bitmap, PointF pointF) {
|
|
m.checkNotNullParameter(bitmap, "<this>");
|
|
m.checkNotNullParameter(pointF, "p");
|
|
float f = pointF.x;
|
|
if (f >= 0.0f && f < ((float) bitmap.getWidth())) {
|
|
float f2 = pointF.y;
|
|
if (f2 >= 0.0f && f2 < ((float) bitmap.getHeight())) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static final Bitmap createBitmap(int i, int i2, Bitmap.Config config) {
|
|
m.checkNotNullParameter(config, "config");
|
|
Bitmap createBitmap = Bitmap.createBitmap(i, i2, config);
|
|
m.checkNotNullExpressionValue(createBitmap, "createBitmap(width, height, config)");
|
|
return createBitmap;
|
|
}
|
|
|
|
@RequiresApi(26)
|
|
public static final Bitmap createBitmap(int i, int i2, Bitmap.Config config, boolean z2, ColorSpace colorSpace) {
|
|
m.checkNotNullParameter(config, "config");
|
|
m.checkNotNullParameter(colorSpace, "colorSpace");
|
|
Bitmap createBitmap = Bitmap.createBitmap(i, i2, config, z2, colorSpace);
|
|
m.checkNotNullExpressionValue(createBitmap, "createBitmap(width, height, config, hasAlpha, colorSpace)");
|
|
return createBitmap;
|
|
}
|
|
|
|
public static /* synthetic */ Bitmap createBitmap$default(int i, int i2, Bitmap.Config config, int i3, Object obj) {
|
|
if ((i3 & 4) != 0) {
|
|
config = Bitmap.Config.ARGB_8888;
|
|
}
|
|
m.checkNotNullParameter(config, "config");
|
|
Bitmap createBitmap = Bitmap.createBitmap(i, i2, config);
|
|
m.checkNotNullExpressionValue(createBitmap, "createBitmap(width, height, config)");
|
|
return createBitmap;
|
|
}
|
|
|
|
public static /* synthetic */ Bitmap createBitmap$default(int i, int i2, Bitmap.Config config, boolean z2, ColorSpace colorSpace, int i3, Object obj) {
|
|
if ((i3 & 4) != 0) {
|
|
config = Bitmap.Config.ARGB_8888;
|
|
}
|
|
if ((i3 & 8) != 0) {
|
|
z2 = true;
|
|
}
|
|
if ((i3 & 16) != 0) {
|
|
colorSpace = ColorSpace.get(ColorSpace.Named.SRGB);
|
|
m.checkNotNullExpressionValue(colorSpace, "get(ColorSpace.Named.SRGB)");
|
|
}
|
|
m.checkNotNullParameter(config, "config");
|
|
m.checkNotNullParameter(colorSpace, "colorSpace");
|
|
Bitmap createBitmap = Bitmap.createBitmap(i, i2, config, z2, colorSpace);
|
|
m.checkNotNullExpressionValue(createBitmap, "createBitmap(width, height, config, hasAlpha, colorSpace)");
|
|
return createBitmap;
|
|
}
|
|
|
|
public static final int get(Bitmap bitmap, int i, int i2) {
|
|
m.checkNotNullParameter(bitmap, "<this>");
|
|
return bitmap.getPixel(i, i2);
|
|
}
|
|
|
|
public static final Bitmap scale(Bitmap bitmap, int i, int i2, boolean z2) {
|
|
m.checkNotNullParameter(bitmap, "<this>");
|
|
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, i, i2, z2);
|
|
m.checkNotNullExpressionValue(createScaledBitmap, "createScaledBitmap(this, width, height, filter)");
|
|
return createScaledBitmap;
|
|
}
|
|
|
|
public static /* synthetic */ Bitmap scale$default(Bitmap bitmap, int i, int i2, boolean z2, int i3, Object obj) {
|
|
if ((i3 & 4) != 0) {
|
|
z2 = true;
|
|
}
|
|
m.checkNotNullParameter(bitmap, "<this>");
|
|
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, i, i2, z2);
|
|
m.checkNotNullExpressionValue(createScaledBitmap, "createScaledBitmap(this, width, height, filter)");
|
|
return createScaledBitmap;
|
|
}
|
|
|
|
public static final void set(Bitmap bitmap, int i, int i2, @ColorInt int i3) {
|
|
m.checkNotNullParameter(bitmap, "<this>");
|
|
bitmap.setPixel(i, i2, i3);
|
|
}
|
|
}
|