94 lines
3.3 KiB
Java
94 lines
3.3 KiB
Java
package com.kofax.mobile.sdk._internal.impl;
|
|
|
|
import android.graphics.Bitmap;
|
|
import com.kofax.BuildConfig;
|
|
import com.kofax.kmc.ken.engines.data.Image;
|
|
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._internal.g;
|
|
import o.InterfaceC13391fZD;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class u implements com.kofax.mobile.sdk._internal.g {
|
|
@InterfaceC13391fZD
|
|
public u() {
|
|
}
|
|
|
|
@Override // com.kofax.mobile.sdk._internal.g
|
|
public g.a w(Image image) {
|
|
a aVar = new a();
|
|
if (image.getImageRepresentation() == Image.ImageRep.IMAGE_REP_FILE && image.getImageFileRep() == Image.ImageFileRep.FILE_STORED) {
|
|
try {
|
|
ErrorInfo imageReadFromFile = image.imageReadFromFile();
|
|
if (imageReadFromFile != ErrorInfo.KMC_SUCCESS && imageReadFromFile != ErrorInfo.KMC_ED_ALTERNATE_FILEIO_ENGINE) {
|
|
throw new KmcRuntimeException(imageReadFromFile);
|
|
}
|
|
aVar.wI = true;
|
|
aVar.wJ = true;
|
|
aVar.t = image;
|
|
aVar._bitmap = image.getImageBitmap();
|
|
} catch (KmcException e) {
|
|
throw new KmcRuntimeException(e.getErrorInfo());
|
|
}
|
|
} else if (image.getImageRepresentation() == Image.ImageRep.IMAGE_REP_BITMAP || image.getImageRepresentation() == Image.ImageRep.IMAGE_REP_BOTH) {
|
|
aVar._bitmap = image.getImageBitmap();
|
|
} else {
|
|
if (image.getImageFileRep() == Image.ImageFileRep.FILE_BUFFERED) {
|
|
throw new KmcRuntimeException(ErrorInfo.KMC_IP_FILE_AND_BUFFERED_REPRESENTATION);
|
|
}
|
|
throw new KmcRuntimeException(ErrorInfo.KMC_IP_NO_REPRESENTATION);
|
|
}
|
|
return aVar;
|
|
}
|
|
|
|
/* loaded from: classes3.dex */
|
|
class a implements g.a {
|
|
Bitmap _bitmap;
|
|
Image t;
|
|
boolean wI;
|
|
boolean wJ;
|
|
final u wK;
|
|
|
|
private a(u uVar) {
|
|
this.wK = uVar;
|
|
}
|
|
|
|
@Override // com.kofax.mobile.sdk._internal.g.a
|
|
public boolean be() {
|
|
ErrorInfo clearBitmapWithoutRecycle;
|
|
synchronized (this) {
|
|
try {
|
|
if (!this.wI) {
|
|
return false;
|
|
}
|
|
try {
|
|
if (this.wJ) {
|
|
clearBitmapWithoutRecycle = this.t.imageClearBitmap();
|
|
} else {
|
|
clearBitmapWithoutRecycle = new Image.FriendI(this.t, BuildConfig.APPLICATION_ID).clearBitmapWithoutRecycle();
|
|
}
|
|
} catch (KmcException unused) {
|
|
}
|
|
if (clearBitmapWithoutRecycle == ErrorInfo.KMC_SUCCESS) {
|
|
return true;
|
|
}
|
|
throw new KmcRuntimeException(clearBitmapWithoutRecycle);
|
|
} finally {
|
|
this.wI = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.kofax.mobile.sdk._internal.g.a
|
|
public void i(boolean z) {
|
|
this.wJ = z;
|
|
}
|
|
|
|
@Override // com.kofax.mobile.sdk._internal.g.a
|
|
public Bitmap getBitmap() {
|
|
return this._bitmap;
|
|
}
|
|
}
|
|
}
|