package kj;

import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.Shader;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;

/* loaded from: classes3.dex */
public class a {

    /* renamed from: i, reason: collision with root package name */
    private static final int[] f25858i = new int[3];

    /* renamed from: j, reason: collision with root package name */
    private static final float[] f25859j = {BitmapDescriptorFactory.HUE_RED, 0.5f, 1.0f};

    /* renamed from: k, reason: collision with root package name */
    private static final int[] f25860k = new int[4];

    /* renamed from: l, reason: collision with root package name */
    private static final float[] f25861l = {BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 0.5f, 1.0f};

    /* renamed from: a, reason: collision with root package name */
    private final Paint f25862a;

    /* renamed from: b, reason: collision with root package name */
    private final Paint f25863b;

    /* renamed from: c, reason: collision with root package name */
    private final Paint f25864c;

    /* renamed from: d, reason: collision with root package name */
    private int f25865d;

    /* renamed from: e, reason: collision with root package name */
    private int f25866e;

    /* renamed from: f, reason: collision with root package name */
    private int f25867f;

    /* renamed from: g, reason: collision with root package name */
    private final Path f25868g;

    /* renamed from: h, reason: collision with root package name */
    private Paint f25869h;

    public a() {
        this(-16777216);
    }

    public void a(Canvas canvas, Matrix matrix, RectF rectF, int i10, float f10, float f11) {
        boolean z10 = f11 < BitmapDescriptorFactory.HUE_RED;
        Path path = this.f25868g;
        if (z10) {
            int[] iArr = f25860k;
            iArr[0] = 0;
            iArr[1] = this.f25867f;
            iArr[2] = this.f25866e;
            iArr[3] = this.f25865d;
        } else {
            path.rewind();
            path.moveTo(rectF.centerX(), rectF.centerY());
            path.arcTo(rectF, f10, f11);
            path.close();
            float f12 = -i10;
            rectF.inset(f12, f12);
            int[] iArr2 = f25860k;
            iArr2[0] = 0;
            iArr2[1] = this.f25865d;
            iArr2[2] = this.f25866e;
            iArr2[3] = this.f25867f;
        }
        float width = rectF.width() / 2.0f;
        if (width <= BitmapDescriptorFactory.HUE_RED) {
            return;
        }
        float f13 = 1.0f - (i10 / width);
        float[] fArr = f25861l;
        fArr[1] = f13;
        fArr[2] = ((1.0f - f13) / 2.0f) + f13;
        this.f25863b.setShader(new RadialGradient(rectF.centerX(), rectF.centerY(), width, f25860k, fArr, Shader.TileMode.CLAMP));
        canvas.save();
        canvas.concat(matrix);
        canvas.scale(1.0f, rectF.height() / rectF.width());
        if (!z10) {
            canvas.clipPath(path, Region.Op.DIFFERENCE);
            canvas.drawPath(path, this.f25869h);
        }
        canvas.drawArc(rectF, f10, f11, true, this.f25863b);
        canvas.restore();
    }

    public void b(Canvas canvas, Matrix matrix, RectF rectF, int i10) {
        rectF.bottom += i10;
        rectF.offset(BitmapDescriptorFactory.HUE_RED, -i10);
        int[] iArr = f25858i;
        iArr[0] = this.f25867f;
        iArr[1] = this.f25866e;
        iArr[2] = this.f25865d;
        Paint paint = this.f25864c;
        float f10 = rectF.left;
        paint.setShader(new LinearGradient(f10, rectF.top, f10, rectF.bottom, iArr, f25859j, Shader.TileMode.CLAMP));
        canvas.save();
        canvas.concat(matrix);
        canvas.drawRect(rectF, this.f25864c);
        canvas.restore();
    }

    public Paint c() {
        return this.f25862a;
    }

    public void d(int i10) {
        this.f25865d = androidx.core.graphics.a.j(i10, 68);
        this.f25866e = androidx.core.graphics.a.j(i10, 20);
        this.f25867f = androidx.core.graphics.a.j(i10, 0);
        this.f25862a.setColor(this.f25865d);
    }

    public a(int i10) {
        this.f25868g = new Path();
        this.f25869h = new Paint();
        this.f25862a = new Paint();
        d(i10);
        this.f25869h.setColor(0);
        Paint paint = new Paint(4);
        this.f25863b = paint;
        paint.setStyle(Paint.Style.FILL);
        this.f25864c = new Paint(paint);
    }
}
