package com.kofax.kmc.ken.engines.data; import android.graphics.Point; import com.kofax.BuildConfig; import com.kofax.kmc.ken.engines.version.KenVersion; import com.kofax.kmc.kut.utilities.SdkVersion; import com.kofax.kmc.kut.utilities.error.ErrorInfo; import com.kofax.kmc.kut.utilities.error.KmcException; import com.kofax.kmc.kut.utilities.error.KmcRuntimeException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import o.gjJ; /* loaded from: classes3.dex */ public class BoundingTetragon implements Serializable, Cloneable { private static final String TAG = "BoundingTetragon"; private static final long serialVersionUID = 6111310662346562354L; private transient Point cw = new Point(0, 0); private transient Point cx = new Point(0, 0); private transient Point cy = new Point(0, 0); private transient Point cz = new Point(0, 0); /* loaded from: classes3.dex */ public enum Rotation { LEFT, RIGHT, FLIP } public BoundingTetragon() { } /* renamed from: clone, reason: merged with bridge method [inline-methods] */ public BoundingTetragon m268clone() { try { BoundingTetragon boundingTetragon = (BoundingTetragon) super.clone(); if (boundingTetragon.cw != null) { boundingTetragon.cw = new Point(boundingTetragon.cw); } if (boundingTetragon.cx != null) { boundingTetragon.cx = new Point(boundingTetragon.cx); } if (boundingTetragon.cy != null) { boundingTetragon.cy = new Point(boundingTetragon.cy); } if (boundingTetragon.cz != null) { boundingTetragon.cz = new Point(boundingTetragon.cz); } return boundingTetragon; } catch (CloneNotSupportedException unused) { throw new InternalError("BoundingTetragon: unexpected clone not supported exception"); } } public BoundingTetragon(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) { this.cw.set(i, i2); this.cx.set(i3, i4); this.cy.set(i5, i6); this.cz.set(i7, i8); } public BoundingTetragon(Point point, Point point2, Point point3, Point point4) { this.cw.set(point.x, point.y); this.cx.set(point2.x, point2.y); this.cy.set(point3.x, point3.y); this.cz.set(point4.x, point4.y); } public Point getTopLeft() { return new Point(this.cw); } public void setTopLeft(Point point) { if (point == null) { this.cw = null; } else { this.cw.set(point.x, point.y); } } public Point getTopRight() { return new Point(this.cx); } public void setTopRight(Point point) { if (point == null) { this.cx = null; } else { this.cx.set(point.x, point.y); } } public Point getBottomLeft() { return new Point(this.cy); } public void setBottomLeft(Point point) { if (point == null) { this.cy = null; } else { this.cy.set(point.x, point.y); } } public Point getBottomRight() { return new Point(this.cz); } public void setBottomRight(Point point) { if (point == null) { this.cz = null; } else { this.cz.set(point.x, point.y); } } /* renamed from: com.kofax.kmc.ken.engines.data.BoundingTetragon$1, reason: invalid class name */ /* loaded from: classes3.dex */ static /* synthetic */ class AnonymousClass1 { static final int[] cA; static { int[] iArr = new int[Rotation.values().length]; cA = iArr; try { iArr[Rotation.LEFT.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { cA[Rotation.FLIP.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { cA[Rotation.RIGHT.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } } } public void rotate(int i, int i2, Rotation rotation) { Point point; Point point2; Point point3; Point point4; if (rotation == null) { throw new IllegalArgumentException("rotation cannot be null"); } int i3 = AnonymousClass1.cA[rotation.ordinal()]; if (i3 == 1) { Point point5 = this.cw; point5.set(point5.y, i - this.cw.x); Point point6 = this.cx; point6.set(point6.y, i - this.cx.x); Point point7 = this.cy; point7.set(point7.y, i - this.cy.x); Point point8 = this.cz; point8.set(point8.y, i - this.cz.x); point = this.cw; point2 = this.cx; point3 = this.cy; point4 = this.cz; } else if (i3 == 2) { Point point9 = this.cw; point9.set(i - point9.x, i2 - this.cw.y); Point point10 = this.cx; point10.set(i - point10.x, i2 - this.cx.y); Point point11 = this.cy; point11.set(i - point11.x, i2 - this.cy.y); Point point12 = this.cz; point12.set(i - point12.x, i2 - this.cz.y); point3 = this.cw; point = this.cx; point4 = this.cy; point2 = this.cz; } else { if (i3 != 3) { return; } Point point13 = this.cw; point13.set(i2 - point13.y, this.cw.x); Point point14 = this.cx; point14.set(i2 - point14.y, this.cx.x); Point point15 = this.cy; point15.set(i2 - point15.y, this.cy.x); Point point16 = this.cz; point16.set(i2 - point16.y, this.cz.x); point4 = this.cw; point3 = this.cx; point2 = this.cy; point = this.cz; } this.cw = point2; this.cx = point4; this.cy = point; this.cz = point3; } private void writeObject(ObjectOutputStream objectOutputStream) throws IOException { objectOutputStream.defaultWriteObject(); objectOutputStream.writeObject(BoundingTetragon.class.getName()); objectOutputStream.writeObject(KenVersion.getPackageVersion()); objectOutputStream.writeObject(Integer.valueOf(this.cw.x)); objectOutputStream.writeObject(Integer.valueOf(this.cw.y)); objectOutputStream.writeObject(Integer.valueOf(this.cx.x)); objectOutputStream.writeObject(Integer.valueOf(this.cx.y)); objectOutputStream.writeObject(Integer.valueOf(this.cy.x)); objectOutputStream.writeObject(Integer.valueOf(this.cy.y)); objectOutputStream.writeObject(Integer.valueOf(this.cz.x)); objectOutputStream.writeObject(Integer.valueOf(this.cz.y)); } private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException, KmcRuntimeException { objectInputStream.defaultReadObject(); if (BoundingTetragon.class.getName().compareToIgnoreCase((String) objectInputStream.readObject()) == 0) { if (SdkVersion.versionCompatible(KenVersion.getPackageVersion(), (String) objectInputStream.readObject()).booleanValue()) { this.cw = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue()); this.cx = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue()); this.cy = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue()); this.cz = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue()); return; } throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_VERSION_ERROR); } throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_OBJECT_ERROR); } /* loaded from: classes3.dex */ public class FriendBT { final BoundingTetragon cB; public FriendBT(BoundingTetragon boundingTetragon, String str) throws KmcException { this.cB = boundingTetragon; if (!gjJ.c((CharSequence) str, (CharSequence) BuildConfig.APPLICATION_ID)) { throw new KmcException(ErrorInfo.KMC_GN_UNSUPPORTED_OPERATION); } } public boolean isValid() { return this.cB.cw.x <= this.cB.cx.x && this.cB.cw.y <= this.cB.cy.y && this.cB.cx.y <= this.cB.cz.y && this.cB.cy.x <= this.cB.cz.x; } public boolean isAllZero() { return this.cB.cw.x == 0 && this.cB.cw.y == 0 && this.cB.cy.x == 0 && this.cB.cy.y == 0 && this.cB.cx.x == 0 && this.cB.cx.y == 0 && this.cB.cz.x == 0 && this.cB.cz.y == 0; } public String toExtCornersOpString(String str) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(""); String obj = sb.toString(); StringBuilder sb2 = new StringBuilder(); sb2.append(obj); sb2.append(str); sb2.append(""); String obj2 = sb2.toString(); StringBuilder sb3 = new StringBuilder(); sb3.append(obj2); sb3.append(str); sb3.append(""); String obj3 = sb3.toString(); StringBuilder sb4 = new StringBuilder(); sb4.append(obj3); sb4.append(str); sb4.append(""); String obj4 = sb4.toString(); StringBuilder sb5 = new StringBuilder(); sb5.append(obj4); sb5.append(str); sb5.append(""); String obj5 = sb5.toString(); StringBuilder sb6 = new StringBuilder(); sb6.append(obj5); sb6.append(str); sb6.append(""); String obj6 = sb6.toString(); StringBuilder sb7 = new StringBuilder(); sb7.append(obj6); sb7.append(str); sb7.append(""); String obj7 = sb7.toString(); StringBuilder sb8 = new StringBuilder(); sb8.append(obj7); sb8.append(str); sb8.append(""); String obj8 = sb8.toString(); StringBuilder sb9 = new StringBuilder(); sb9.append(obj8); sb9.append(str); sb9.append(""); return sb9.toString(); } } }