what-the-bank/sources/com/kofax/mobile/sdk/ae/b.java

126 lines
4.9 KiB
Java

package com.kofax.mobile.sdk.ae;
import android.graphics.Bitmap;
import com.kofax.kmc.ken.engines.ImageProcessor;
import com.kofax.kmc.ken.engines.data.Image;
import com.kofax.kmc.ken.engines.data.ImagePerfectionProfile;
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 com.kofax.mobile.sdk.capture.parameter.ProcessingParameters;
import com.kofax.mobile.sdk.capture.processing.IImageProcessor;
import com.kofax.mobile.sdk.capture.processing.IImageProcessorListener;
import o.InterfaceC13391fZD;
/* loaded from: classes3.dex */
public class b implements IImageProcessor {
private boolean Co;
private final ImageProcessor TQ;
private ProcessingParameters TR;
private Image t;
@InterfaceC13391fZD
public b(ImageProcessor imageProcessor) {
if (imageProcessor == null) {
throw new IllegalArgumentException("processor cannot be null");
}
this.TQ = imageProcessor;
}
@Override // com.kofax.mobile.sdk.capture.processing.IImageProcessor
@Deprecated
public void process(Bitmap bitmap) {
process(new Image(bitmap));
}
@Override // com.kofax.mobile.sdk.capture.processing.IImageProcessor
public void process(Image image) {
synchronized (this) {
if (image == null) {
throw new KmcRuntimeException(ErrorInfo.KMC_GN_INTERNAL_ERROR, new Throwable("No image available for processing"));
}
this.Co = true;
this.t = image;
ImagePerfectionProfile imagePerfectionProfile = new ImagePerfectionProfile();
imagePerfectionProfile.setIpOperations(this.TR.operations);
if (this.TR.useMrzPageDetection) {
imagePerfectionProfile.setUseMRZPassportDetection(ImagePerfectionProfile.UseMRZPassportDetection.ON);
}
if (this.TR.useTargetFrameCrop) {
imagePerfectionProfile.setUseTargetFrameCrop(ImagePerfectionProfile.UseTargetFrameCrop.ON);
}
this.TQ.setImagePerfectionProfile(imagePerfectionProfile);
this.TQ.setProcessedImageMimeType(Image.ImageMimeType.MIMETYPE_TIFF);
this.TQ.setProcessedImageRepresentation(Image.ImageRep.IMAGE_REP_BITMAP);
try {
this.TQ.processImage(this.t);
} catch (KmcException e) {
this.Co = false;
throw new KmcRuntimeException(e.getErrorInfo());
}
}
}
@Override // com.kofax.mobile.sdk.capture.processing.IImageProcessor
public void cancel() {
synchronized (this) {
if (this.Co) {
this.TQ.cancel();
}
}
}
@Override // com.kofax.mobile.sdk.capture.processing.IImageProcessor
public void setImageOutListener(IImageProcessorListener iImageProcessorListener) {
this.TQ.addImageOutEventListener(new ImageProcessor.ImageOutListener(this, iImageProcessorListener) { // from class: com.kofax.mobile.sdk.ae.b.1
final IImageProcessorListener TS;
final b TT;
{
this.TT = this;
this.TS = iImageProcessorListener;
}
@Override // com.kofax.kmc.ken.engines.ImageProcessor.ImageOutListener
public void imageOut(ImageProcessor.ImageOutEvent imageOutEvent) {
synchronized (this.TT) {
try {
if (!imageOutEvent.getStatus().equals(ErrorInfo.KMC_EV_CANCEL_OPERATION_SUCCESS)) {
if (this.TS != null) {
imageOutEvent.getImage().setImageMimeType(Image.ImageMimeType.MIMETYPE_TIFF);
this.TS.onImageProcessed(imageOutEvent.getImage());
}
} else {
Image image = imageOutEvent.getImage();
if (image != null) {
try {
image.imageClearBitmap();
image.imageClearFileBuffer();
} catch (KmcException unused) {
}
}
}
} finally {
this.TT.Co = false;
}
}
}
});
}
@Override // com.kofax.mobile.sdk.capture.processing.IImageProcessor
public void setParameters(ProcessingParameters processingParameters) {
if (processingParameters == null) {
throw new IllegalArgumentException("parameters cannot be null");
}
this.TR = processingParameters;
}
private void a(com.kofax.mobile.sdk._internal.dagger.d dVar) {
try {
this.TQ.doCleanup();
} catch (Exception unused) {
}
}
}