package epson.print; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.media.ExifInterface; import com.epson.cameracopy.printlayout.ImageAndLayout; import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.Scalar; import org.opencv.imgcodecs.Imgcodecs; import java.io.File; import java.io.IOException; import java.util.ArrayList; import epson.common.BMPFile; import epson.common.ExternalFileUtils; import epson.common.ImageUtil; import epson.common.Info_paper; import epson.image.epsonImage; import epson.print.Util.EPLog; import epson.print.Util.ImageFormatIdentifier; import epson.print.Util.Photo; import epson.print.Util.Utils; import epson.print.phlayout.BorderedLayoutPosition; public class EPImageCreator implements CommonDefine { private static String CANCEL_FILE_NAME = null; private static final int EPS_ERR_NONE = 0; private static final Object lockObject = new Object(); private Rect dst = new Rect(0, 0, 0, 0); private Context mContext = null; private epsonImage mEpsonImage = new epsonImage(); private volatile boolean mStopREquested; private Rect src = new Rect(0, 0, 0, 0); EPImageUtil util = new EPImageUtil(); Utils utilFolder = new Utils(); private int getFontSize(int i) { if (i == 4) { return 16; } if (i != 8) { return i != 16 ? 40 : 66; } return 33; } public static int getPrintAreaResolution(int i, int i2) { switch (i) { case 0: case 1: return 1; default: if (i2 == 4) { return 16; } switch (i2) { case 1: return 4; case 2: return 8; default: return 1; } } } static { System.loadLibrary("opencv_java3"); } public EPImageCreator(Context context) { mContext = context; CANCEL_FILE_NAME = new File(ExternalFileUtils.getInstance(mContext).getTempViewDir(), EPImageUtil.CANCEL_FILE_BASE_NAME).getPath(); deleteCancelFile(); } EPImageCreator() { } protected void finalize() throws Throwable { deleteCancelFile(); } public synchronized void requestStop() { mStopREquested = true; makeCancelFile(); } public synchronized boolean stopRequested() { return mStopREquested; } private String LoadJpegFile(EPImage ePImage, int i) { String str; if (stopRequested()) { deleteCancelFile(); ePImage.loadImageFileName = null; return null; } else if (ePImage.loadImageFileName == null) { EPLog.w("EPImageCreator", "loadImageFileName is null"); return null; } else { try { switch (ImageFormatIdentifier.identifyImageFormat(ePImage.loadImageFileName)) { case 1: ePImage.decodeImageFileName = ePImage.loadImageFileName; break; case 2: String png2jpeg = ImageUtil.png2jpeg(mContext, ePImage.loadImageFileName, i); if (stopRequested()) { deleteCancelFile(); return null; } String path = new File(ExternalFileUtils.getInstance(mContext).getTempViewDir(), png2jpeg).getPath(); String tempViewDir = ExternalFileUtils.getInstance(mContext).getTempViewDir(); ePImage.decodeImageFileName = new File(tempViewDir, "decode_" + (ePImage.index + 1) + ".bmp").getPath(); if (util.jpg2bmp(path, ePImage.decodeImageFileName, 1) != 0) { if (stopRequested()) { deleteCancelFile(); return null; } ePImage.decodeImageFileName = null; throw new IllegalStateException(); } break; case 3: String tempViewDir2 = ExternalFileUtils.getInstance(mContext).getTempViewDir(); ePImage.decodeImageFileName = new File(tempViewDir2, "decode_" + (ePImage.index + 1) + ".bmp").getPath(); if (util.jpg2bmp(ePImage.loadImageFileName, ePImage.decodeImageFileName, i) == 0) { int attributeInt = new ExifInterface(ePImage.loadImageFileName).getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, 0); String str2 = ePImage.decodeImageFileName; if (attributeInt == 3) { String tempViewDir3 = ExternalFileUtils.getInstance(mContext).getTempViewDir(); str = new File(tempViewDir3, "decode_" + (ePImage.index + 1) + "_180.bmp").getPath(); util.rotate180Image(str2, str); } else if (attributeInt == 6) { String tempViewDir4 = ExternalFileUtils.getInstance(mContext).getTempViewDir(); str = new File(tempViewDir4, "decode_" + (ePImage.index + 1) + "_90.bmp").getPath(); util.rotateR90Image(str2, str); } else if (attributeInt != 8) { str = str2; } else { String tempViewDir5 = ExternalFileUtils.getInstance(mContext).getTempViewDir(); str = new File(tempViewDir5, "decode_" + (ePImage.index + 1) + "_270.bmp").getPath(); util.rotateR270Image(str2, str); } if (attributeInt == 3 || attributeInt == 6 || attributeInt == 8) { if (str2.startsWith(ExternalFileUtils.getInstance(mContext).getTempViewDir())) { EPLog.i("createPrintImage", "Delete decorded image : " + str2); new File(str2).delete(); } } ePImage.decodeImageFileName = str; break; } else if (stopRequested()) { EPLog.e("EPImageCreator", "EPImageCreator::LoadJpegFile() jpg2bmp stoped."); return null; } else { ePImage.decodeImageFileName = null; throw new IllegalStateException(); } default: return null; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(ePImage.decodeImageFileName, options); if (options.outWidth <= 0 || options.outHeight <= 0) { if (mEpsonImage == null) { mEpsonImage = new epsonImage(); } if (mEpsonImage != null) { int[] iArr = new int[2]; mEpsonImage.epsmpGetImageSize2(ePImage.decodeImageFileName, iArr); ePImage.decodeWidth = iArr[0]; ePImage.decodeHeight = iArr[1]; } return ePImage.loadImageFileName; } ePImage.decodeWidth = options.outWidth; ePImage.decodeHeight = options.outHeight; return ePImage.loadImageFileName; } catch (Exception e) { e.printStackTrace(); ePImage.loadImageFileName = null; } } } /* JADX WARNING: Removed duplicated region for block: B:24:0x0031 A[Catch:{ Exception -> 0x00fa }] */ /* JADX WARNING: Removed duplicated region for block: B:27:0x003b A[Catch:{ Exception -> 0x00fa }] */ /* JADX WARNING: Removed duplicated region for block: B:31:0x0040 A[SYNTHETIC, Splitter:B:31:0x0040] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public String createThumbnailImage(EPImage r21, int r22, int r23) { /* r20 = this; r1 = r20 r2 = r21 r0 = r22 r3 = r23 java.lang.Object r4 = lockObject monitor-enter(r4) java.lang.String r5 = "EPImageCreator" java.lang.String r6 = "Lcok function by createThumbnailImage()." epson.print.Util.EPLog.d(r5, r6) // Catch:{ all -> 0x0104 } r5 = 0 java.lang.String r6 = r2.thumbnailImageFileName // Catch:{ Exception -> 0x00fa } if (r6 == 0) goto L_0x001b java.lang.String r0 = r2.thumbnailImageFileName // Catch:{ Exception -> 0x00fa } monitor-exit(r4) // Catch:{ all -> 0x0104 } return r0 L_0x001b: r6 = 1 if (r0 <= r3) goto L_0x0026 int r7 = r2.srcWidth // Catch:{ Exception -> 0x00fa } if (r7 <= r0) goto L_0x002e int r7 = r2.srcWidth // Catch:{ Exception -> 0x00fa } int r7 = r7 / r0 goto L_0x002f L_0x0026: int r7 = r2.srcHeight // Catch:{ Exception -> 0x00fa } if (r7 <= r3) goto L_0x002e int r7 = r2.srcHeight // Catch:{ Exception -> 0x00fa } int r7 = r7 / r3 goto L_0x002f L_0x002e: r7 = 1 L_0x002f: if (r7 >= r6) goto L_0x0032 r7 = 1 L_0x0032: r1.LoadJpegFile(r2, r7) // Catch:{ Exception -> 0x00fa } boolean r7 = r20.stopRequested() // Catch:{ Exception -> 0x00fa } if (r7 == 0) goto L_0x0040 r20.deleteCancelFile() // Catch:{ Exception -> 0x00fa } monitor-exit(r4) // Catch:{ all -> 0x0104 } return r5 L_0x0040: java.lang.String r7 = r2.decodeImageFileName // Catch:{ Exception -> 0x00fa } if (r7 == 0) goto L_0x00f4 int r7 = r2.decodeWidth // Catch:{ Exception -> 0x00fa } int r8 = r2.decodeHeight // Catch:{ Exception -> 0x00fa } if (r7 <= r8) goto L_0x005f int r7 = r2.decodeWidth // Catch:{ Exception -> 0x00fa } int r7 = r7 * r3 int r8 = r2.decodeHeight // Catch:{ Exception -> 0x00fa } int r7 = r7 / r8 if (r7 >= r0) goto L_0x005b int r3 = r2.decodeHeight // Catch:{ Exception -> 0x00fa } int r3 = r3 * r0 int r7 = r2.decodeWidth // Catch:{ Exception -> 0x00fa } int r3 = r3 / r7 goto L_0x005c L_0x005b: r0 = r7 L_0x005c: r10 = r0 r11 = r3 goto L_0x0074 L_0x005f: int r7 = r2.decodeHeight // Catch:{ Exception -> 0x00fa } int r7 = r7 * r0 int r8 = r2.decodeWidth // Catch:{ Exception -> 0x00fa } int r7 = r7 / r8 if (r7 >= r3) goto L_0x0072 int r0 = r2.decodeWidth // Catch:{ Exception -> 0x00fa } int r0 = r0 * r3 int r7 = r2.decodeHeight // Catch:{ Exception -> 0x00fa } int r0 = r0 / r7 r10 = r0 r11 = r3 goto L_0x0074 L_0x0072: r10 = r0 r11 = r7 L_0x0074: java.io.File r0 = new java.io.File // Catch:{ Exception -> 0x00fa } android.content.Context r3 = r1.mContext // Catch:{ Exception -> 0x00fa } epson.common.ExternalFileUtils r3 = epson.common.ExternalFileUtils.getInstance(r3) // Catch:{ Exception -> 0x00fa } java.lang.String r3 = r3.getTempViewDir() // Catch:{ Exception -> 0x00fa } java.lang.StringBuilder r7 = new java.lang.StringBuilder // Catch:{ Exception -> 0x00fa } r7.() // Catch:{ Exception -> 0x00fa } java.lang.String r8 = "thumbnail_" r7.append(r8) // Catch:{ Exception -> 0x00fa } int r8 = r2.index // Catch:{ Exception -> 0x00fa } int r8 = r8 + r6 r7.append(r8) // Catch:{ Exception -> 0x00fa } java.lang.String r8 = ".bmp" r7.append(r8) // Catch:{ Exception -> 0x00fa } java.lang.String r7 = r7.toString() // Catch:{ Exception -> 0x00fa } r0.(r3, r7) // Catch:{ Exception -> 0x00fa } java.lang.String r0 = r0.getPath() // Catch:{ Exception -> 0x00fa } r2.thumbnailImageFileName = r0 // Catch:{ Exception -> 0x00fa } epson.print.EPImageUtil r7 = r1.util // Catch:{ Exception -> 0x00fa } java.lang.String r8 = r2.decodeImageFileName // Catch:{ Exception -> 0x00fa } java.lang.String r9 = r2.thumbnailImageFileName // Catch:{ Exception -> 0x00fa } r12 = 0 r13 = 0 int r0 = r2.decodeWidth // Catch:{ Exception -> 0x00fa } int r14 = r0 + -1 int r0 = r2.decodeHeight // Catch:{ Exception -> 0x00fa } int r15 = r0 + -1 r16 = 0 r17 = 0 int r18 = r10 + -1 int r19 = r11 + -1 r7.resizeImage(r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19) // Catch:{ Exception -> 0x00fa } java.lang.String r0 = r2.decodeImageFileName // Catch:{ Exception -> 0x00fa } android.content.Context r3 = r1.mContext // Catch:{ Exception -> 0x00fa } epson.common.ExternalFileUtils r3 = epson.common.ExternalFileUtils.getInstance(r3) // Catch:{ Exception -> 0x00fa } java.lang.String r3 = r3.getTempViewDir() // Catch:{ Exception -> 0x00fa } boolean r0 = r0.startsWith(r3) // Catch:{ Exception -> 0x00fa } if (r0 == 0) goto L_0x0100 java.lang.String r0 = "createPrintImage" java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch:{ Exception -> 0x00fa } r3.() // Catch:{ Exception -> 0x00fa } java.lang.String r6 = "Delete decorded image : " r3.append(r6) // Catch:{ Exception -> 0x00fa } java.lang.String r6 = r2.decodeImageFileName // Catch:{ Exception -> 0x00fa } r3.append(r6) // Catch:{ Exception -> 0x00fa } java.lang.String r3 = r3.toString() // Catch:{ Exception -> 0x00fa } epson.print.Util.EPLog.i(r0, r3) // Catch:{ Exception -> 0x00fa } java.io.File r0 = new java.io.File // Catch:{ Exception -> 0x00fa } java.lang.String r3 = r2.decodeImageFileName // Catch:{ Exception -> 0x00fa } r0.(r3) // Catch:{ Exception -> 0x00fa } r0.delete() // Catch:{ Exception -> 0x00fa } r2.decodeImageFileName = r5 // Catch:{ Exception -> 0x00fa } goto L_0x0100 L_0x00f4: java.lang.IllegalStateException r0 = new java.lang.IllegalStateException // Catch:{ Exception -> 0x00fa } r0.() // Catch:{ Exception -> 0x00fa } throw r0 // Catch:{ Exception -> 0x00fa } L_0x00fa: r0 = move-exception r0.printStackTrace() // Catch:{ all -> 0x0104 } r2.thumbnailImageFileName = r5 // Catch:{ all -> 0x0104 } L_0x0100: java.lang.String r0 = r2.thumbnailImageFileName // Catch:{ all -> 0x0104 } monitor-exit(r4) // Catch:{ all -> 0x0104 } return r0 L_0x0104: r0 = move-exception monitor-exit(r4) // Catch:{ all -> 0x0104 } throw r0 */ throw new UnsupportedOperationException("Method not decompiled: epson.print.EPImageCreator.createThumbnailImage(epson.print.EPImage, int, int):java.lang.String"); } /* JADX WARNING: Removed duplicated region for block: B:26:0x0036 A[Catch:{ Exception -> 0x001d }] */ /* JADX WARNING: Removed duplicated region for block: B:29:0x0040 A[Catch:{ Exception -> 0x001d }] */ /* JADX WARNING: Removed duplicated region for block: B:33:0x0045 A[SYNTHETIC, Splitter:B:33:0x0045] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public String createPreviewImage(EPImage r21, int r22, int r23, int r24, boolean r25) { /* r20 = this; r1 = r20 r2 = r21 r0 = r22 r3 = r23 java.lang.Object r4 = lockObject monitor-enter(r4) java.lang.String r5 = "EPImageCreator" java.lang.String r6 = "Lcok function by createPreviewImage()." epson.print.Util.EPLog.d(r5, r6) // Catch:{ all -> 0x017a } r5 = 0 if (r25 != 0) goto L_0x0020 java.lang.String r6 = r2.previewImageFileName // Catch:{ Exception -> 0x001d } if (r6 == 0) goto L_0x0020 java.lang.String r0 = r2.previewImageFileName // Catch:{ Exception -> 0x001d } monitor-exit(r4) // Catch:{ all -> 0x017a } return r0 L_0x001d: r0 = move-exception goto L_0x0171 L_0x0020: r6 = 1 if (r0 <= r3) goto L_0x002b int r7 = r2.srcWidth // Catch:{ Exception -> 0x001d } if (r7 <= r0) goto L_0x0033 int r7 = r2.srcWidth // Catch:{ Exception -> 0x001d } int r7 = r7 / r0 goto L_0x0034 L_0x002b: int r7 = r2.srcHeight // Catch:{ Exception -> 0x001d } if (r7 <= r3) goto L_0x0033 int r7 = r2.srcHeight // Catch:{ Exception -> 0x001d } int r7 = r7 / r3 goto L_0x0034 L_0x0033: r7 = 1 L_0x0034: if (r7 >= r6) goto L_0x0037 r7 = 1 L_0x0037: r1.LoadJpegFile(r2, r7) // Catch:{ Exception -> 0x001d } boolean r7 = r20.stopRequested() // Catch:{ Exception -> 0x001d } if (r7 == 0) goto L_0x0045 r20.deleteCancelFile() // Catch:{ Exception -> 0x001d } monitor-exit(r4) // Catch:{ all -> 0x017a } return r5 L_0x0045: java.lang.String r7 = r2.decodeImageFileName // Catch:{ Exception -> 0x001d } if (r7 == 0) goto L_0x016b int r7 = r2.decodeWidth // Catch:{ Exception -> 0x001d } int r8 = r2.decodeHeight // Catch:{ Exception -> 0x001d } if (r7 <= r8) goto L_0x0066 int r7 = r2.decodeWidth // Catch:{ Exception -> 0x001d } int r7 = r7 * r3 int r8 = r2.decodeHeight // Catch:{ Exception -> 0x001d } int r7 = r7 / r8 if (r7 >= r0) goto L_0x0060 int r3 = r2.decodeHeight // Catch:{ Exception -> 0x001d } int r3 = r3 * r0 int r7 = r2.decodeWidth // Catch:{ Exception -> 0x001d } int r3 = r3 / r7 goto L_0x0061 L_0x0060: r0 = r7 L_0x0061: r15 = r3 r3 = r0 r0 = r24 goto L_0x007f L_0x0066: int r7 = r2.decodeHeight // Catch:{ Exception -> 0x001d } int r7 = r7 * r0 int r8 = r2.decodeWidth // Catch:{ Exception -> 0x001d } int r7 = r7 / r8 if (r7 >= r3) goto L_0x007b int r0 = r2.decodeWidth // Catch:{ Exception -> 0x001d } int r0 = r0 * r3 int r7 = r2.decodeHeight // Catch:{ Exception -> 0x001d } int r0 = r0 / r7 r15 = r3 r3 = r0 r0 = r24 goto L_0x007f L_0x007b: r3 = r0 r15 = r7 r0 = r24 L_0x007f: if (r0 != r6) goto L_0x00e4 java.lang.String r0 = r2.decodeImageFileName // Catch:{ Exception -> 0x001d } java.io.File r7 = new java.io.File // Catch:{ Exception -> 0x001d } android.content.Context r8 = r1.mContext // Catch:{ Exception -> 0x001d } epson.common.ExternalFileUtils r8 = epson.common.ExternalFileUtils.getInstance(r8) // Catch:{ Exception -> 0x001d } java.lang.String r8 = r8.getTempViewDir() // Catch:{ Exception -> 0x001d } java.lang.StringBuilder r9 = new java.lang.StringBuilder // Catch:{ Exception -> 0x001d } r9.() // Catch:{ Exception -> 0x001d } java.lang.String r10 = "preview_" r9.append(r10) // Catch:{ Exception -> 0x001d } int r10 = r2.index // Catch:{ Exception -> 0x001d } int r10 = r10 + r6 r9.append(r10) // Catch:{ Exception -> 0x001d } java.lang.String r10 = "_gray.bmp" r9.append(r10) // Catch:{ Exception -> 0x001d } java.lang.String r9 = r9.toString() // Catch:{ Exception -> 0x001d } r7.(r8, r9) // Catch:{ Exception -> 0x001d } java.lang.String r7 = r7.getPath() // Catch:{ Exception -> 0x001d } epson.print.EPImageUtil r8 = r1.util // Catch:{ Exception -> 0x001d } r8.color2grayscale(r0, r7) // Catch:{ Exception -> 0x001d } android.content.Context r8 = r1.mContext // Catch:{ Exception -> 0x001d } epson.common.ExternalFileUtils r8 = epson.common.ExternalFileUtils.getInstance(r8) // Catch:{ Exception -> 0x001d } java.lang.String r8 = r8.getTempViewDir() // Catch:{ Exception -> 0x001d } boolean r8 = r0.startsWith(r8) // Catch:{ Exception -> 0x001d } if (r8 == 0) goto L_0x00e2 java.lang.String r8 = "createPrintImage" java.lang.StringBuilder r9 = new java.lang.StringBuilder // Catch:{ Exception -> 0x001d } r9.() // Catch:{ Exception -> 0x001d } java.lang.String r10 = "Delete decorded image : " r9.append(r10) // Catch:{ Exception -> 0x001d } r9.append(r0) // Catch:{ Exception -> 0x001d } java.lang.String r9 = r9.toString() // Catch:{ Exception -> 0x001d } epson.print.Util.EPLog.i(r8, r9) // Catch:{ Exception -> 0x001d } java.io.File r8 = new java.io.File // Catch:{ Exception -> 0x001d } r8.(r0) // Catch:{ Exception -> 0x001d } r8.delete() // Catch:{ Exception -> 0x001d } L_0x00e2: r2.decodeImageFileName = r7 // Catch:{ Exception -> 0x001d } L_0x00e4: java.io.File r0 = new java.io.File // Catch:{ Exception -> 0x001d } android.content.Context r7 = r1.mContext // Catch:{ Exception -> 0x001d } epson.common.ExternalFileUtils r7 = epson.common.ExternalFileUtils.getInstance(r7) // Catch:{ Exception -> 0x001d } java.lang.String r7 = r7.getTempViewDir() // Catch:{ Exception -> 0x001d } java.lang.StringBuilder r8 = new java.lang.StringBuilder // Catch:{ Exception -> 0x001d } r8.() // Catch:{ Exception -> 0x001d } java.lang.String r9 = "preview_" r8.append(r9) // Catch:{ Exception -> 0x001d } int r9 = r2.index // Catch:{ Exception -> 0x001d } int r9 = r9 + r6 r8.append(r9) // Catch:{ Exception -> 0x001d } java.lang.String r9 = ".bmp" r8.append(r9) // Catch:{ Exception -> 0x001d } java.lang.String r8 = r8.toString() // Catch:{ Exception -> 0x001d } r0.(r7, r8) // Catch:{ Exception -> 0x001d } java.lang.String r0 = r0.getPath() // Catch:{ Exception -> 0x001d } r2.previewImageFileName = r0 // Catch:{ Exception -> 0x001d } epson.print.EPImageUtil r7 = r1.util // Catch:{ Exception -> 0x001d } java.lang.String r8 = r2.decodeImageFileName // Catch:{ Exception -> 0x001d } java.lang.String r9 = r2.previewImageFileName // Catch:{ Exception -> 0x001d } r12 = 0 r13 = 0 int r0 = r2.decodeWidth // Catch:{ Exception -> 0x001d } int r14 = r0 + -1 int r0 = r2.decodeHeight // Catch:{ Exception -> 0x001d } int r0 = r0 - r6 r16 = 0 r17 = 0 int r18 = r3 + -1 int r19 = r15 + -1 r10 = r3 r11 = r15 r6 = r15 r15 = r0 r7.resizeImage(r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19) // Catch:{ Exception -> 0x001d } java.lang.String r0 = r2.decodeImageFileName // Catch:{ Exception -> 0x001d } android.content.Context r7 = r1.mContext // Catch:{ Exception -> 0x001d } epson.common.ExternalFileUtils r7 = epson.common.ExternalFileUtils.getInstance(r7) // Catch:{ Exception -> 0x001d } java.lang.String r7 = r7.getTempViewDir() // Catch:{ Exception -> 0x001d } boolean r0 = r0.startsWith(r7) // Catch:{ Exception -> 0x001d } if (r0 == 0) goto L_0x0166 java.lang.String r0 = "createPrintImage" java.lang.StringBuilder r7 = new java.lang.StringBuilder // Catch:{ Exception -> 0x001d } r7.() // Catch:{ Exception -> 0x001d } java.lang.String r8 = "Delete decorded image : " r7.append(r8) // Catch:{ Exception -> 0x001d } java.lang.String r8 = r2.decodeImageFileName // Catch:{ Exception -> 0x001d } r7.append(r8) // Catch:{ Exception -> 0x001d } java.lang.String r7 = r7.toString() // Catch:{ Exception -> 0x001d } epson.print.Util.EPLog.i(r0, r7) // Catch:{ Exception -> 0x001d } java.io.File r0 = new java.io.File // Catch:{ Exception -> 0x001d } java.lang.String r7 = r2.decodeImageFileName // Catch:{ Exception -> 0x001d } r0.(r7) // Catch:{ Exception -> 0x001d } r0.delete() // Catch:{ Exception -> 0x001d } r2.decodeImageFileName = r5 // Catch:{ Exception -> 0x001d } L_0x0166: r2.previewWidth = r3 // Catch:{ Exception -> 0x001d } r2.previewHeight = r6 // Catch:{ Exception -> 0x001d } goto L_0x0176 L_0x016b: java.lang.IllegalStateException r0 = new java.lang.IllegalStateException // Catch:{ Exception -> 0x001d } r0.() // Catch:{ Exception -> 0x001d } throw r0 // Catch:{ Exception -> 0x001d } L_0x0171: r0.printStackTrace() // Catch:{ all -> 0x017a } r2.previewImageFileName = r5 // Catch:{ all -> 0x017a } L_0x0176: java.lang.String r0 = r2.previewImageFileName // Catch:{ all -> 0x017a } monitor-exit(r4) // Catch:{ all -> 0x017a } return r0 L_0x017a: r0 = move-exception monitor-exit(r4) // Catch:{ all -> 0x017a } throw r0 */ throw new UnsupportedOperationException("Method not decompiled: epson.print.EPImageCreator.createPreviewImage(epson.print.EPImage, int, int, int, boolean):java.lang.String"); } public String createPrintImage(Context context, EPImage ePImage, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, boolean z, boolean z2) { int[] iArr; EPImage ePImage2 = ePImage; int i9 = i5; int i10 = i8; int convertRotationValue = convertRotationValue(ePImage2.rotate); if (i9 == 4) { iArr = new int[]{i2, i3}; } else { iArr = getPrintAreaSize(mContext, i4, i9, i6); if (z2) { int i11 = iArr[0]; iArr[0] = iArr[1]; iArr[1] = i11; } } double printParPreviewRate = getPrintParPreviewRate(ePImage2, convertRotationValue, iArr); ImageAndLayout imageAndLayout = new ImageAndLayout(); imageAndLayout.setLayoutAreaSize(iArr[0], iArr[1]); double[] layoutValues = getLayoutValues(convertRotationValue, ePImage2, printParPreviewRate); ImageAndLayout imageAndLayout2 = imageAndLayout; imageAndLayout.setLayout(layoutValues[0], layoutValues[1], layoutValues[2], layoutValues[3], convertRotationValue); imageAndLayout2.setOrgFileName(ePImage2.loadImageFileName); String printFilename = getPrintFilename(mContext, ePImage2.index); imageAndLayout2.setOpenCvExifRotationCancel(false); boolean z3 = true; imageAndLayout2.createPrintData(printFilename, i7 == 1, new int[]{i2, i3}, 0); ePImage2.decodeImageFileName = printFilename; if (i10 != 0) { String dateTimeSystem = Photo.getDateTimeSystem(ePImage.getOriginalFileName(), i10); if (i9 != 1) { z3 = false; } writeDate(ePImage, i2, i3, dateTimeSystem, i, z3); } return printFilename; } private double getPrintParPreviewRate(EPImage ePImage, int i, int[] iArr) { return (((i & 1) == 1 ? iArr[0] : iArr[1])) / ((ePImage.previewPaperRectBottom - ePImage.previewPaperRectTop)); } private int convertRotationValue(int i) { return (i / 90) & 3; } private double[] getLayoutValues(int i, EPImage ePImage, double d) { double[] dArr = new double[4]; if (i == 0 || i == 2) { dArr[0] = ((ePImage.previewImageRectRight - ePImage.previewImageRectLeft)) * d; dArr[1] = ((ePImage.previewImageRectBottom - ePImage.previewImageRectTop)) * d; } else { dArr[0] = ((ePImage.previewImageRectBottom - ePImage.previewImageRectTop)) * d; dArr[1] = ((ePImage.previewImageRectRight - ePImage.previewImageRectLeft)) * d; } switch (i) { case 1: dArr[2] = (((-ePImage.previewImageRectBottom) + ((float) ePImage.previewPaperRectBottom))) * d; dArr[3] = ((ePImage.previewImageRectLeft - ((float) ePImage.previewPaperRectLeft))) * d; break; case 2: dArr[2] = (((-ePImage.previewImageRectRight) + ((float) ePImage.previewPaperRectRight))) * d; dArr[3] = (((-ePImage.previewImageRectBottom) + ((float) ePImage.previewPaperRectBottom))) * d; break; case 3: dArr[2] = ((ePImage.previewImageRectTop - ((float) ePImage.previewPaperRectTop))) * d; dArr[3] = (((-ePImage.previewImageRectRight) + ((float) ePImage.previewPaperRectRight))) * d; break; default: dArr[2] = ((ePImage.previewImageRectLeft - ((float) ePImage.previewPaperRectLeft))) * d; dArr[3] = ((ePImage.previewImageRectTop - ((float) ePImage.previewPaperRectTop))) * d; break; } return dArr; } private int[] getPrintAreaSize(Context context, int i, int i2, int i3) { if (i2 != 1) { return new BorderedLayoutPosition().getPrintSize(context, i, i3); } Info_paper infoPaper = Info_paper.getInfoPaper(context, i); return new int[]{infoPaper.getPaper_width_boderless(), infoPaper.getPaper_height_boderless()}; } private String getPrintFilename(Context context, int i) { String printDir = ExternalFileUtils.getInstance(context).getPrintDir(); return new File(printDir, (i + 1) + ".bmp").getPath(); } public String createMultiPrintImage(Context context, int i, int i2, EPImageList ePImageList, int i3, int i4, int i5, int i6, int i7, int i8, int i9, boolean z) { Rect rect; int i10; int i11; Mat mat; EPImage ePImage; boolean z2; boolean z3; int i12 = i; int i13 = i2; EPImageList ePImageList2 = ePImageList; int i14 = i3; int i15 = i4; int i16 = i5; int i17 = i9; new ArrayList(); boolean z4 = ePImageList2.get(0).isPaperLandScape; Mat mat2 = new Mat(i16, i15, CvType.CV_8UC3, Scalar.all(255.0d)); boolean z5 = i15 > i16; if (i12 == 65536) { i10 = i14 * 2; rect = Info_paper.getRect_2in1(i15, i16, i13, true); } else if (i12 == 131072 || i12 == 262144) { i10 = i14 * 4; rect = Info_paper.getRect_4in1(i15, i16, i13, true); } else { rect = null; i10 = 0; } boolean z6 = rect.width() > rect.height(); while (true) { try { EPImage ePImage2 = ePImageList2.get(i10); if (ePImage2 == null) { mat = mat2; i11 = i14; } else { if (ePImage2.isPaperLandScape != z6) { if (z5) { ePImage2.rotate += EPImage.EPS_ROTATE_270; } else { ePImage2.rotate += 90; } } int i18 = i10; boolean z7 = z6; boolean z8 = z5; Mat mat3 = mat2; boolean z9 = z4; i11 = i14; String createPrintImage = createPrintImage(context, ePImage2, i2, rect.width(), rect.height(), i6, 2, i, i7, i8, false, z); if (createPrintImage == null) { mat = mat3; } else { if (i12 != 65536) { if (i12 != 131072) { if (i12 != 262144) { z2 = z8; mat = mat3; z3 = z9; } } int i19 = i18 % 4; z2 = z8; z3 = z9; mat = mat3; MakeMultiPrintImage.layoutPrintImage(mat, createPrintImage, MakeMultiPrintImage.calcLayout4in1(i12, z2, z3, i19)); if (i19 == 3) { } } else { z2 = z8; mat = mat3; z3 = z9; switch (i18 % 2) { case 0: MakeMultiPrintImage.layoutPrintImage(mat, createPrintImage, 0); continue; case 1: MakeMultiPrintImage.layoutPrintImage(mat, createPrintImage, 3); break; default: continue; } } i10 = i18 + 1; z4 = z3; z5 = z2; mat2 = mat; i14 = i11; z6 = z7; int i20 = i9; int i21 = i5; int i22 = i4; int i23 = i2; } } } catch (IndexOutOfBoundsException unused) { mat = mat2; i11 = i14; } catch (Throwable unused2) { mat = mat2; i11 = i14; } } String path = new File(ExternalFileUtils.getInstance(context).getPrintDir(), "multi_" + (i11 + 1) + ".bmp").getPath(); Imgcodecs.imwrite(path, mat); mat.release(); int i24 = i9; if (i24 % 360 == 0) { ePImage = new EPImage(); ePImage.decodeImageFileName = path; } else { EPImage ePImage3 = new EPImage(path, i11); ePImage3.rotate = i24; ePImage3.decodeImageFileName = path; rotate(ePImage3, i4, i5); ePImage = ePImage3; } return ePImage.decodeImageFileName; } /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v15, resolved type: int} */ /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v18, resolved type: int} */ /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v19, resolved type: int} */ /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v42, resolved type: int} */ /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v60, resolved type: int} */ /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v63, resolved type: int} */ /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v66, resolved type: int} */ /* JADX WARNING: type inference failed for: r10v16 */ /* JADX WARNING: Multi-variable type inference failed */ /* JADX WARNING: Removed duplicated region for block: B:100:0x02bf A[SYNTHETIC, Splitter:B:100:0x02bf] */ /* JADX WARNING: Removed duplicated region for block: B:109:0x0336 A[Catch:{ Exception -> 0x00ed }] */ /* JADX WARNING: Removed duplicated region for block: B:114:0x03d0 */ /* JADX WARNING: Removed duplicated region for block: B:120:0x03f6 A[Catch:{ Exception -> 0x0413 }] */ /* JADX WARNING: Removed duplicated region for block: B:20:0x0032 */ /* JADX WARNING: Removed duplicated region for block: B:24:0x003c A[SYNTHETIC, Splitter:B:24:0x003c] */ /* JADX WARNING: Removed duplicated region for block: B:29:0x0041 A[SYNTHETIC, Splitter:B:29:0x0041] */ /* JADX WARNING: Removed duplicated region for block: B:91:0x01fd A[SYNTHETIC, Splitter:B:91:0x01fd] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public String createPrintImage_origi(Context r27, EPImage r28, int r29, int r30, int r31, int r32, int r33, int r34, int r35, boolean r36) { /* r26 = this; r8 = r26 r9 = r28 r3 = r30 r4 = r31 r1 = r33 r2 = r35 java.lang.Object r23 = lockObject monitor-enter(r23) java.lang.String r5 = "EPImageCreator" java.lang.String r6 = "Lcok function by createPrintImage()." epson.print.Util.EPLog.d(r5, r6) // Catch:{ all -> 0x042b } r7 = 0 r5 = 1 if (r3 <= r4) goto L_0x0027 int r6 = r9.srcWidth // Catch:{ Exception -> 0x0022 } if (r6 <= r3) goto L_0x002f int r6 = r9.srcWidth // Catch:{ Exception -> 0x0022 } int r6 = r6 / r3 goto L_0x0030 L_0x0022: r0 = move-exception r1 = r0 r10 = r7 goto L_0x0422 L_0x0027: int r6 = r9.srcHeight // Catch:{ Exception -> 0x041f } if (r6 <= r4) goto L_0x002f int r6 = r9.srcHeight // Catch:{ Exception -> 0x0022 } int r6 = r6 / r4 goto L_0x0030 L_0x002f: r6 = 1 L_0x0030: if (r6 >= r5) goto L_0x0033 r6 = 1 L_0x0033: r8.LoadJpegFile(r9, r6) // Catch:{ Exception -> 0x041f } boolean r6 = r26.stopRequested() // Catch:{ Exception -> 0x041f } if (r6 == 0) goto L_0x0041 r26.deleteCancelFile() // Catch:{ Exception -> 0x0022 } monitor-exit(r23) // Catch:{ all -> 0x042b } return r7 L_0x0041: java.lang.String r6 = r9.decodeImageFileName // Catch:{ Exception -> 0x041f } if (r6 == 0) goto L_0x0416 int r6 = r9.decodeWidth // Catch:{ Exception -> 0x041f } float r6 = (float) r6 // Catch:{ Exception -> 0x041f } int r10 = r9.previewWidth // Catch:{ Exception -> 0x041f } float r10 = (float) r10 // Catch:{ Exception -> 0x041f } float r6 = r6 / r10 int r10 = r9.decodeHeight // Catch:{ Exception -> 0x041f } float r10 = (float) r10 // Catch:{ Exception -> 0x041f } int r11 = r9.previewHeight // Catch:{ Exception -> 0x041f } float r11 = (float) r11 // Catch:{ Exception -> 0x041f } float r10 = r10 / r11 float r6 = java.lang.Math.max(r6, r10) // Catch:{ Exception -> 0x041f } android.graphics.Rect r10 = r8.src // Catch:{ Exception -> 0x041f } android.graphics.Rect r11 = r8.src // Catch:{ Exception -> 0x041f } android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x041f } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x041f } r15 = 0 r13.bottom = r15 // Catch:{ Exception -> 0x041f } r12.right = r15 // Catch:{ Exception -> 0x041f } r11.top = r15 // Catch:{ Exception -> 0x041f } r10.left = r15 // Catch:{ Exception -> 0x041f } android.graphics.Rect r10 = r8.dst // Catch:{ Exception -> 0x041f } android.graphics.Rect r11 = r8.dst // Catch:{ Exception -> 0x041f } android.graphics.Rect r12 = r8.dst // Catch:{ Exception -> 0x041f } android.graphics.Rect r13 = r8.dst // Catch:{ Exception -> 0x041f } r13.bottom = r15 // Catch:{ Exception -> 0x041f } r12.right = r15 // Catch:{ Exception -> 0x041f } r11.top = r15 // Catch:{ Exception -> 0x041f } r10.left = r15 // Catch:{ Exception -> 0x041f } android.graphics.Rect r10 = r8.src // Catch:{ Exception -> 0x041f } int r11 = r9.previewPaperRectLeft // Catch:{ Exception -> 0x041f } float r11 = (float) r11 // Catch:{ Exception -> 0x041f } float r12 = r9.previewImageRectLeft // Catch:{ Exception -> 0x041f } float r11 = r11 - r12 int r11 = r11 // Catch:{ Exception -> 0x041f } r10.left = r11 // Catch:{ Exception -> 0x041f } android.graphics.Rect r10 = r8.src // Catch:{ Exception -> 0x041f } int r11 = r9.previewPaperRectTop // Catch:{ Exception -> 0x041f } float r11 = (float) r11 // Catch:{ Exception -> 0x041f } float r12 = r9.previewImageRectTop // Catch:{ Exception -> 0x041f } float r11 = r11 - r12 int r11 = r11 // Catch:{ Exception -> 0x041f } r10.top = r11 // Catch:{ Exception -> 0x041f } android.graphics.Rect r10 = r8.src // Catch:{ Exception -> 0x041f } int r10 = r10.left // Catch:{ Exception -> 0x041f } if (r10 >= 0) goto L_0x009e android.graphics.Rect r10 = r8.src // Catch:{ Exception -> 0x0022 } int r10 = r10.left // Catch:{ Exception -> 0x0022 } int r10 = -r10 android.graphics.Rect r11 = r8.src // Catch:{ Exception -> 0x0022 } r11.left = r15 // Catch:{ Exception -> 0x0022 } goto L_0x009f L_0x009e: r10 = 0 L_0x009f: android.graphics.Rect r11 = r8.src // Catch:{ Exception -> 0x041f } int r11 = r11.top // Catch:{ Exception -> 0x041f } if (r11 >= 0) goto L_0x00af android.graphics.Rect r11 = r8.src // Catch:{ Exception -> 0x0022 } int r11 = r11.top // Catch:{ Exception -> 0x0022 } int r11 = -r11 android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x0022 } r12.top = r15 // Catch:{ Exception -> 0x0022 } goto L_0x00b0 L_0x00af: r11 = 0 L_0x00b0: int r12 = r9.previewPaperRectRight // Catch:{ Exception -> 0x041f } float r12 = (float) r12 // Catch:{ Exception -> 0x041f } float r13 = r9.previewImageRectRight // Catch:{ Exception -> 0x041f } int r12 = (r12 > r13 ? 1 : (r12 == r13 ? 0 : -1)) if (r12 > 0) goto L_0x00c6 android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x0022 } int r13 = r9.previewPaperRectRight // Catch:{ Exception -> 0x0022 } float r13 = (float) r13 // Catch:{ Exception -> 0x0022 } float r14 = r9.previewImageRectLeft // Catch:{ Exception -> 0x0022 } float r13 = r13 - r14 int r13 = r13 // Catch:{ Exception -> 0x0022 } r12.right = r13 // Catch:{ Exception -> 0x0022 } r12 = 0 goto L_0x00d7 L_0x00c6: android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x041f } float r13 = r9.previewImageRectRight // Catch:{ Exception -> 0x041f } float r14 = r9.previewImageRectLeft // Catch:{ Exception -> 0x041f } float r13 = r13 - r14 int r13 = r13 // Catch:{ Exception -> 0x041f } r12.right = r13 // Catch:{ Exception -> 0x041f } int r12 = r9.previewPaperRectRight // Catch:{ Exception -> 0x041f } float r12 = (float) r12 // Catch:{ Exception -> 0x041f } float r13 = r9.previewImageRectRight // Catch:{ Exception -> 0x041f } float r12 = r12 - r13 int r12 = r12 // Catch:{ Exception -> 0x041f } L_0x00d7: int r13 = r9.previewPaperRectBottom // Catch:{ Exception -> 0x041f } float r13 = (float) r13 // Catch:{ Exception -> 0x041f } float r14 = r9.previewImageRectBottom // Catch:{ Exception -> 0x041f } int r13 = (r13 > r14 ? 1 : (r13 == r14 ? 0 : -1)) if (r13 > 0) goto L_0x00f2 android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0022 } int r14 = r9.previewPaperRectBottom // Catch:{ Exception -> 0x0022 } float r14 = (float) r14 float r7 = r9.previewImageRectTop // Catch:{ Exception -> 0x00ed } float r14 = r14 - r7 int r7 = r14 // Catch:{ Exception -> 0x00ed } r13.bottom = r7 // Catch:{ Exception -> 0x00ed } r7 = 0 goto L_0x0103 L_0x00ed: r0 = move-exception r1 = r0 r10 = 0 goto L_0x0422 L_0x00f2: android.graphics.Rect r7 = r8.src // Catch:{ Exception -> 0x0413 } float r13 = r9.previewImageRectBottom // Catch:{ Exception -> 0x0413 } float r14 = r9.previewImageRectTop // Catch:{ Exception -> 0x0413 } float r13 = r13 - r14 int r13 = r13 // Catch:{ Exception -> 0x0413 } r7.bottom = r13 // Catch:{ Exception -> 0x0413 } int r7 = r9.previewPaperRectBottom // Catch:{ Exception -> 0x0413 } float r7 = (float) r7 // Catch:{ Exception -> 0x0413 } float r13 = r9.previewImageRectBottom // Catch:{ Exception -> 0x0413 } float r7 = r7 - r13 int r7 = r7 // Catch:{ Exception -> 0x0413 } L_0x0103: android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.left // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r15 = r9.scaleFactor // Catch:{ Exception -> 0x0413 } float r14 = r14 / r15 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.left = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.top // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r15 = r9.scaleFactor // Catch:{ Exception -> 0x0413 } float r14 = r14 / r15 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.top = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.right // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r15 = r9.scaleFactor // Catch:{ Exception -> 0x0413 } float r14 = r14 / r15 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.right = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.bottom // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r15 = r9.scaleFactor // Catch:{ Exception -> 0x0413 } float r14 = r14 / r15 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.bottom = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.left // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r14 = r14 * r6 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.left = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.top // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r14 = r14 * r6 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.top = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.right // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r14 = r14 * r6 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.right = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r14 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r14.bottom // Catch:{ Exception -> 0x0413 } float r14 = (float) r14 // Catch:{ Exception -> 0x0413 } float r14 = r14 * r6 int r14 = r14 // Catch:{ Exception -> 0x0413 } r13.bottom = r14 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } int r13 = r13.right // Catch:{ Exception -> 0x0413 } int r14 = r9.decodeWidth // Catch:{ Exception -> 0x0413 } int r14 = r14 - r5 r15 = 1073741824(0x40000000, float:2.0) if (r13 <= r14) goto L_0x0187 android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x00ed } int r13 = r13.right // Catch:{ Exception -> 0x00ed } int r14 = r9.decodeWidth // Catch:{ Exception -> 0x00ed } int r13 = r13 - r14 int r13 = r13 + r5 float r13 = (float) r13 // Catch:{ Exception -> 0x00ed } float r13 = r13 / r15 float r13 = r13 / r6 int r13 = r13 // Catch:{ Exception -> 0x00ed } int r10 = r10 + r13 int r12 = r12 + r13 android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x00ed } int r14 = r9.decodeWidth // Catch:{ Exception -> 0x00ed } int r14 = r14 - r5 r13.right = r14 // Catch:{ Exception -> 0x00ed } L_0x0187: android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x0413 } int r13 = r13.bottom // Catch:{ Exception -> 0x0413 } int r14 = r9.decodeHeight // Catch:{ Exception -> 0x0413 } int r14 = r14 - r5 if (r13 <= r14) goto L_0x01a5 android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x00ed } int r13 = r13.bottom // Catch:{ Exception -> 0x00ed } int r14 = r9.decodeHeight // Catch:{ Exception -> 0x00ed } int r13 = r13 - r14 int r13 = r13 + r5 float r13 = (float) r13 // Catch:{ Exception -> 0x00ed } float r13 = r13 / r15 float r13 = r13 / r6 int r6 = r13 // Catch:{ Exception -> 0x00ed } int r11 = r11 + r6 int r7 = r7 + r6 android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x00ed } int r13 = r9.decodeHeight // Catch:{ Exception -> 0x00ed } int r13 = r13 - r5 r6.bottom = r13 // Catch:{ Exception -> 0x00ed } L_0x01a5: float r6 = (float) r3 int r13 = r9.previewPaperRectRight // Catch:{ Exception -> 0x0413 } int r14 = r9.previewPaperRectLeft // Catch:{ Exception -> 0x0413 } int r13 = r13 - r14 int r13 = r13 + r5 float r13 = (float) r13 // Catch:{ Exception -> 0x0413 } float r6 = r6 / r13 int r13 = r9.rotate // Catch:{ Exception -> 0x0413 } int r13 = r13 % 360 r14 = 90 if (r13 == r14) goto L_0x01c5 int r13 = r9.rotate // Catch:{ Exception -> 0x00ed } int r13 = r13 % 360 r14 = 270(0x10e, float:3.78E-43) if (r13 != r14) goto L_0x01bf goto L_0x01c5 L_0x01bf: r25 = r12 r12 = r7 r7 = r25 goto L_0x01d3 L_0x01c5: float r6 = (float) r4 int r13 = r9.previewPaperRectRight // Catch:{ Exception -> 0x0413 } int r14 = r9.previewPaperRectLeft // Catch:{ Exception -> 0x0413 } int r13 = r13 - r14 int r13 = r13 + r5 float r13 = (float) r13 // Catch:{ Exception -> 0x0413 } float r6 = r6 / r13 r25 = r11 r11 = r10 r10 = r25 L_0x01d3: android.graphics.Rect r13 = r8.dst // Catch:{ Exception -> 0x0413 } float r10 = (float) r10 // Catch:{ Exception -> 0x0413 } float r10 = r10 * r6 int r10 = r10 // Catch:{ Exception -> 0x0413 } r13.left = r10 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r10 = r8.dst // Catch:{ Exception -> 0x0413 } float r11 = (float) r11 // Catch:{ Exception -> 0x0413 } float r11 = r11 * r6 int r11 = r11 // Catch:{ Exception -> 0x0413 } r10.top = r11 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r10 = r8.dst // Catch:{ Exception -> 0x0413 } int r11 = r3 + -1 float r11 = (float) r11 // Catch:{ Exception -> 0x0413 } float r7 = (float) r7 // Catch:{ Exception -> 0x0413 } float r7 = r7 * r6 float r11 = r11 - r7 int r7 = r11 // Catch:{ Exception -> 0x0413 } r10.right = r7 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r7 = r8.dst // Catch:{ Exception -> 0x0413 } int r10 = r4 + -1 float r10 = (float) r10 // Catch:{ Exception -> 0x0413 } float r11 = (float) r12 // Catch:{ Exception -> 0x0413 } float r11 = r11 * r6 float r10 = r10 - r11 int r6 = r10 // Catch:{ Exception -> 0x0413 } r7.bottom = r6 // Catch:{ Exception -> 0x0413 } if (r1 != r5) goto L_0x0266 android.content.Context r6 = r8.mContext // Catch:{ Exception -> 0x00ed } r7 = r32 epson.common.Info_paper r6 = epson.common.Info_paper.getInfoPaper(r6, r7) // Catch:{ Exception -> 0x00ed } int r7 = r6.getTopMargin() // Catch:{ Exception -> 0x00ed } int r7 = -r7 int r10 = r6.getLeftMargin() // Catch:{ Exception -> 0x00ed } int r10 = -r10 int r11 = r6.getBottomMargin() // Catch:{ Exception -> 0x00ed } int r11 = -r11 int r12 = r6.getRightMargin() // Catch:{ Exception -> 0x00ed } int r12 = -r12 if (r36 == 0) goto L_0x022a android.graphics.Rect r13 = r8.src // Catch:{ Exception -> 0x00ed } int r13 = r13.width() // Catch:{ Exception -> 0x00ed } float r13 = (float) r13 // Catch:{ Exception -> 0x00ed } int r6 = r6.getPaper_width_boderless() // Catch:{ Exception -> 0x00ed } int r6 = r6 - r5 float r6 = (float) r6 // Catch:{ Exception -> 0x00ed } float r13 = r13 / r6 goto L_0x023a L_0x022a: android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x00ed } int r6 = r6.width() // Catch:{ Exception -> 0x00ed } float r6 = (float) r6 // Catch:{ Exception -> 0x00ed } android.graphics.Rect r13 = r8.dst // Catch:{ Exception -> 0x00ed } int r13 = r13.width() // Catch:{ Exception -> 0x00ed } float r13 = (float) r13 // Catch:{ Exception -> 0x00ed } float r13 = r6 / r13 L_0x023a: float r6 = (float) r7 // Catch:{ Exception -> 0x00ed } float r6 = r6 * r13 int r6 = r6 // Catch:{ Exception -> 0x00ed } float r7 = (float) r10 // Catch:{ Exception -> 0x00ed } float r7 = r7 * r13 int r7 = r7 // Catch:{ Exception -> 0x00ed } float r10 = (float) r11 // Catch:{ Exception -> 0x00ed } float r10 = r10 * r13 int r10 = r10 // Catch:{ Exception -> 0x00ed } float r11 = (float) r12 // Catch:{ Exception -> 0x00ed } float r11 = r11 * r13 int r11 = r11 // Catch:{ Exception -> 0x00ed } android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x00ed } int r13 = r12.top // Catch:{ Exception -> 0x00ed } int r13 = r13 - r6 r12.top = r13 // Catch:{ Exception -> 0x00ed } android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x00ed } int r12 = r6.left // Catch:{ Exception -> 0x00ed } int r12 = r12 - r7 r6.left = r12 // Catch:{ Exception -> 0x00ed } android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x00ed } int r7 = r6.bottom // Catch:{ Exception -> 0x00ed } int r7 = r7 + r10 r6.bottom = r7 // Catch:{ Exception -> 0x00ed } android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x00ed } int r7 = r6.right // Catch:{ Exception -> 0x00ed } int r7 = r7 + r11 r6.right = r7 // Catch:{ Exception -> 0x00ed } L_0x0266: android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r7 = r8.src // Catch:{ Exception -> 0x0413 } int r7 = r7.left // Catch:{ Exception -> 0x0413 } int r10 = r9.decodeWidth // Catch:{ Exception -> 0x0413 } int r10 = r10 - r5 int r7 = java.lang.Math.min(r7, r10) // Catch:{ Exception -> 0x0413 } r10 = 0 int r7 = java.lang.Math.max(r10, r7) // Catch:{ Exception -> 0x0413 } r6.left = r7 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r7 = r8.src // Catch:{ Exception -> 0x0413 } int r7 = r7.top // Catch:{ Exception -> 0x0413 } int r10 = r9.decodeHeight // Catch:{ Exception -> 0x0413 } int r10 = r10 - r5 int r7 = java.lang.Math.min(r7, r10) // Catch:{ Exception -> 0x0413 } r10 = 0 int r7 = java.lang.Math.max(r10, r7) // Catch:{ Exception -> 0x0413 } r6.top = r7 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r7 = r8.src // Catch:{ Exception -> 0x0413 } int r7 = r7.right // Catch:{ Exception -> 0x0413 } int r10 = r9.decodeWidth // Catch:{ Exception -> 0x0413 } int r10 = r10 - r5 int r7 = java.lang.Math.min(r7, r10) // Catch:{ Exception -> 0x0413 } r10 = 0 int r7 = java.lang.Math.max(r10, r7) // Catch:{ Exception -> 0x0413 } r6.right = r7 // Catch:{ Exception -> 0x0413 } android.graphics.Rect r6 = r8.src // Catch:{ Exception -> 0x0413 } android.graphics.Rect r7 = r8.src // Catch:{ Exception -> 0x0413 } int r7 = r7.bottom // Catch:{ Exception -> 0x0413 } int r10 = r9.decodeHeight // Catch:{ Exception -> 0x0413 } int r10 = r10 - r5 int r7 = java.lang.Math.min(r7, r10) // Catch:{ Exception -> 0x0413 } r15 = 0 int r7 = java.lang.Math.max(r15, r7) // Catch:{ Exception -> 0x0413 } r6.bottom = r7 // Catch:{ Exception -> 0x0413 } java.lang.String r6 = r9.decodeImageFileName // Catch:{ Exception -> 0x0413 } r8.rotate(r9, r3, r4) // Catch:{ Exception -> 0x0413 } int r7 = r9.rotate // Catch:{ Exception -> 0x0413 } if (r7 == 0) goto L_0x02ed android.content.Context r7 = r8.mContext // Catch:{ Exception -> 0x00ed } epson.common.ExternalFileUtils r7 = epson.common.ExternalFileUtils.getInstance(r7) // Catch:{ Exception -> 0x00ed } java.lang.String r7 = r7.getTempViewDir() // Catch:{ Exception -> 0x00ed } boolean r7 = r6.startsWith(r7) // Catch:{ Exception -> 0x00ed } if (r7 == 0) goto L_0x02ed java.lang.String r7 = "createPrintImage" java.lang.StringBuilder r10 = new java.lang.StringBuilder // Catch:{ Exception -> 0x00ed } r10.() // Catch:{ Exception -> 0x00ed } java.lang.String r11 = "Delete decorded image : " r10.append(r11) // Catch:{ Exception -> 0x00ed } r10.append(r6) // Catch:{ Exception -> 0x00ed } java.lang.String r10 = r10.toString() // Catch:{ Exception -> 0x00ed } epson.print.Util.EPLog.i(r7, r10) // Catch:{ Exception -> 0x00ed } java.io.File r7 = new java.io.File // Catch:{ Exception -> 0x00ed } r7.(r6) // Catch:{ Exception -> 0x00ed } r7.delete() // Catch:{ Exception -> 0x00ed } L_0x02ed: if (r36 != 0) goto L_0x0356 r6 = r34 if (r6 != r5) goto L_0x0356 java.lang.String r6 = r9.decodeImageFileName // Catch:{ Exception -> 0x00ed } java.io.File r7 = new java.io.File // Catch:{ Exception -> 0x00ed } android.content.Context r10 = r8.mContext // Catch:{ Exception -> 0x00ed } epson.common.ExternalFileUtils r10 = epson.common.ExternalFileUtils.getInstance(r10) // Catch:{ Exception -> 0x00ed } java.lang.String r10 = r10.getTempViewDir() // Catch:{ Exception -> 0x00ed } java.lang.StringBuilder r11 = new java.lang.StringBuilder // Catch:{ Exception -> 0x00ed } r11.() // Catch:{ Exception -> 0x00ed } java.lang.String r12 = "print_" r11.append(r12) // Catch:{ Exception -> 0x00ed } int r12 = r9.index // Catch:{ Exception -> 0x00ed } int r12 = r12 + r5 r11.append(r12) // Catch:{ Exception -> 0x00ed } java.lang.String r12 = "_gray.bmp" r11.append(r12) // Catch:{ Exception -> 0x00ed } java.lang.String r11 = r11.toString() // Catch:{ Exception -> 0x00ed } r7.(r10, r11) // Catch:{ Exception -> 0x00ed } java.lang.String r7 = r7.getPath() // Catch:{ Exception -> 0x00ed } epson.print.EPImageUtil r10 = r8.util // Catch:{ Exception -> 0x00ed } r10.color2grayscale(r6, r7) // Catch:{ Exception -> 0x00ed } android.content.Context r10 = r8.mContext // Catch:{ Exception -> 0x00ed } epson.common.ExternalFileUtils r10 = epson.common.ExternalFileUtils.getInstance(r10) // Catch:{ Exception -> 0x00ed } java.lang.String r10 = r10.getTempViewDir() // Catch:{ Exception -> 0x00ed } boolean r10 = r6.startsWith(r10) // Catch:{ Exception -> 0x00ed } if (r10 == 0) goto L_0x0354 java.lang.String r10 = "createPrintImage" java.lang.StringBuilder r11 = new java.lang.StringBuilder // Catch:{ Exception -> 0x00ed } r11.() // Catch:{ Exception -> 0x00ed } java.lang.String r12 = "Delete decorded image : " r11.append(r12) // Catch:{ Exception -> 0x00ed } r11.append(r6) // Catch:{ Exception -> 0x00ed } java.lang.String r11 = r11.toString() // Catch:{ Exception -> 0x00ed } epson.print.Util.EPLog.i(r10, r11) // Catch:{ Exception -> 0x00ed } java.io.File r10 = new java.io.File // Catch:{ Exception -> 0x00ed } r10.(r6) // Catch:{ Exception -> 0x00ed } r10.delete() // Catch:{ Exception -> 0x00ed } L_0x0354: r9.decodeImageFileName = r7 // Catch:{ Exception -> 0x00ed } L_0x0356: java.io.File r6 = new java.io.File // Catch:{ Exception -> 0x0413 } android.content.Context r7 = r8.mContext // Catch:{ Exception -> 0x0413 } epson.common.ExternalFileUtils r7 = epson.common.ExternalFileUtils.getInstance(r7) // Catch:{ Exception -> 0x0413 } java.lang.String r7 = r7.getPrintDir() // Catch:{ Exception -> 0x0413 } java.lang.StringBuilder r10 = new java.lang.StringBuilder // Catch:{ Exception -> 0x0413 } r10.() // Catch:{ Exception -> 0x0413 } int r11 = r9.index // Catch:{ Exception -> 0x0413 } int r11 = r11 + r5 r10.append(r11) // Catch:{ Exception -> 0x0413 } java.lang.String r11 = ".bmp" r10.append(r11) // Catch:{ Exception -> 0x0413 } java.lang.String r10 = r10.toString() // Catch:{ Exception -> 0x0413 } r6.(r7, r10) // Catch:{ Exception -> 0x0413 } java.lang.String r6 = r6.getPath() // Catch:{ Exception -> 0x0413 } epson.print.EPImageUtil r10 = r8.util // Catch:{ Exception -> 0x0413 } java.lang.String r11 = r9.decodeImageFileName // Catch:{ Exception -> 0x0413 } android.graphics.Rect r7 = r8.src // Catch:{ Exception -> 0x0413 } int r7 = r7.left // Catch:{ Exception -> 0x0413 } android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x0413 } int r14 = r12.top // Catch:{ Exception -> 0x0413 } android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x0413 } int r13 = r12.right // Catch:{ Exception -> 0x0413 } android.graphics.Rect r12 = r8.src // Catch:{ Exception -> 0x0413 } int r12 = r12.bottom // Catch:{ Exception -> 0x0413 } android.graphics.Rect r15 = r8.dst // Catch:{ Exception -> 0x0413 } int r15 = r15.left // Catch:{ Exception -> 0x0413 } android.graphics.Rect r5 = r8.dst // Catch:{ Exception -> 0x0413 } int r5 = r5.top // Catch:{ Exception -> 0x0413 } android.graphics.Rect r3 = r8.dst // Catch:{ Exception -> 0x0413 } int r3 = r3.right // Catch:{ Exception -> 0x0413 } android.graphics.Rect r4 = r8.dst // Catch:{ Exception -> 0x0413 } int r4 = r4.bottom // Catch:{ Exception -> 0x0413 } r18 = r12 r12 = r6 r17 = r13 r13 = r30 r19 = r14 r14 = r31 r20 = r15 r24 = 0 r15 = r7 r16 = r19 r19 = r20 r20 = r5 r21 = r3 r22 = r4 r10.resizeImage(r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22) // Catch:{ Exception -> 0x0413 } java.lang.String r3 = r9.decodeImageFileName // Catch:{ Exception -> 0x0413 } android.content.Context r4 = r8.mContext // Catch:{ Exception -> 0x0413 } epson.common.ExternalFileUtils r4 = epson.common.ExternalFileUtils.getInstance(r4) // Catch:{ Exception -> 0x0413 } java.lang.String r4 = r4.getTempViewDir() // Catch:{ Exception -> 0x0413 } boolean r3 = r3.startsWith(r4) // Catch:{ Exception -> 0x0413 } if (r3 == 0) goto L_0x03f2 java.lang.String r3 = "createPrintImage" java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch:{ Exception -> 0x00ed } r4.() // Catch:{ Exception -> 0x00ed } java.lang.String r5 = "Delete decorded image : " r4.append(r5) // Catch:{ Exception -> 0x00ed } java.lang.String r5 = r9.decodeImageFileName // Catch:{ Exception -> 0x00ed } r4.append(r5) // Catch:{ Exception -> 0x00ed } java.lang.String r4 = r4.toString() // Catch:{ Exception -> 0x00ed } epson.print.Util.EPLog.i(r3, r4) // Catch:{ Exception -> 0x00ed } java.io.File r3 = new java.io.File // Catch:{ Exception -> 0x00ed } java.lang.String r4 = r9.decodeImageFileName // Catch:{ Exception -> 0x00ed } r3.(r4) // Catch:{ Exception -> 0x00ed } r3.delete() // Catch:{ Exception -> 0x00ed } L_0x03f2: r9.decodeImageFileName = r6 // Catch:{ Exception -> 0x0413 } if (r2 == 0) goto L_0x0427 java.lang.String r3 = r28.getOriginalFileName() // Catch:{ Exception -> 0x0413 } java.lang.String r5 = epson.print.Util.Photo.getDateTimeSystem(r3, r2) // Catch:{ Exception -> 0x0413 } r2 = 1 if (r1 != r2) goto L_0x0403 r7 = 1 goto L_0x0404 L_0x0403: r7 = 0 L_0x0404: r1 = r26 r2 = r28 r3 = r30 r4 = r31 r6 = r29 r10 = 0 r1.writeDate(r2, r3, r4, r5, r6, r7) // Catch:{ Exception -> 0x041d } goto L_0x0427 L_0x0413: r0 = move-exception r10 = 0 goto L_0x0421 L_0x0416: r10 = r7 java.lang.IllegalStateException r1 = new java.lang.IllegalStateException // Catch:{ Exception -> 0x041d } r1.() // Catch:{ Exception -> 0x041d } throw r1 // Catch:{ Exception -> 0x041d } L_0x041d: r0 = move-exception goto L_0x0421 L_0x041f: r0 = move-exception r10 = r7 L_0x0421: r1 = r0 L_0x0422: r1.printStackTrace() // Catch:{ all -> 0x042b } r9.decodeImageFileName = r10 // Catch:{ all -> 0x042b } L_0x0427: java.lang.String r1 = r9.decodeImageFileName // Catch:{ all -> 0x042b } monitor-exit(r23) // Catch:{ all -> 0x042b } return r1 L_0x042b: r0 = move-exception r1 = r0 monitor-exit(r23) // Catch:{ all -> 0x042b } throw r1 */ throw new UnsupportedOperationException("Method not decompiled: epson.print.EPImageCreator.createPrintImage_origi(android.content.Context, epson.print.EPImage, int, int, int, int, int, int, int, boolean):java.lang.String"); } public String createMultiPrintImage_org(Context context, int i, int i2, EPImageList ePImageList, int i3, int i4, int i5, int i6, int i7, int i8, int i9) { Rect rect; int i10; int i11; Mat mat; EPImage ePImage; boolean z; boolean z2; int i12 = i; int i13 = i2; EPImageList ePImageList2 = ePImageList; int i14 = i3; int i15 = i4; int i16 = i5; int i17 = i9; new ArrayList(); boolean z3 = ePImageList2.get(0).isPaperLandScape; Mat mat2 = new Mat(i16, i15, CvType.CV_8UC3, Scalar.all(255.0d)); boolean z4 = i15 > i16; if (i12 == 65536) { i10 = i14 * 2; rect = Info_paper.getRect_2in1(i15, i16, i13, true); } else if (i12 == 131072 || i12 == 262144) { i10 = i14 * 4; rect = Info_paper.getRect_4in1(i15, i16, i13, true); } else { rect = null; i10 = 0; } boolean z5 = rect.width() > rect.height(); while (true) { try { EPImage ePImage2 = ePImageList2.get(i10); if (ePImage2 == null) { mat = mat2; i11 = i16; } else { if (ePImage2.isPaperLandScape != z5) { if (z4) { ePImage2.rotate += EPImage.EPS_ROTATE_270; } else { ePImage2.rotate += 90; } } int i18 = i10; boolean z6 = z5; boolean z7 = z4; Mat mat3 = mat2; boolean z8 = z3; i11 = i16; String createPrintImage_origi = createPrintImage_origi(context, ePImage2, i2, rect.width(), rect.height(), i6, 2, i7, i8, false); if (createPrintImage_origi == null) { mat = mat3; } else { if (i12 != 65536) { if (i12 != 131072) { if (i12 != 262144) { z = z7; mat = mat3; z2 = z8; } } int i19 = i18 % 4; z = z7; z2 = z8; mat = mat3; MakeMultiPrintImage.layoutPrintImage(mat, createPrintImage_origi, MakeMultiPrintImage.calcLayout4in1(i12, z, z2, i19)); if (i19 == 3) { } } else { z = z7; mat = mat3; z2 = z8; switch (i18 % 2) { case 0: MakeMultiPrintImage.layoutPrintImage(mat, createPrintImage_origi, 0); continue; case 1: MakeMultiPrintImage.layoutPrintImage(mat, createPrintImage_origi, 3); break; default: continue; } } i10 = i18 + 1; z3 = z2; z4 = z; mat2 = mat; i16 = i11; z5 = z6; int i20 = i9; int i21 = i2; } } } catch (IndexOutOfBoundsException unused) { mat = mat2; i11 = i16; } catch (Throwable unused2) { mat = mat2; i11 = i16; } } String path = new File(ExternalFileUtils.getInstance(context).getPrintDir(), "multi_" + (i14 + 1) + ".bmp").getPath(); Imgcodecs.imwrite(path, mat); mat.release(); int i22 = i9; if (i22 % 360 == 0) { ePImage = new EPImage(); ePImage.decodeImageFileName = path; } else { EPImage ePImage3 = new EPImage(path, i14); ePImage3.rotate = i22; ePImage3.decodeImageFileName = path; rotate(ePImage3, i15, i11); ePImage = ePImage3; } return ePImage.decodeImageFileName; } static class MakeMultiPrintImage { public static final int LAYOUT_BUTTOMLEFT = 2; public static final int LAYOUT_BUTTOMRIGHT = 3; public static final int LAYOUT_TOPLEFT = 0; public static final int LAYOUT_TOPRIGHT = 1; MakeMultiPrintImage() { } static void layoutPrintImage(Mat mat, String str, int i) { Mat mat2; Mat imread = Imgcodecs.imread(str, -1); switch (i) { case 0: mat2 = mat.submat(0, imread.rows(), 0, imread.cols()); break; case 1: mat2 = mat.submat(0, imread.rows(), mat.cols() - imread.cols(), mat.cols()); break; case 2: mat2 = mat.submat(mat.rows() - imread.rows(), mat.rows(), 0, imread.cols()); break; case 3: mat2 = mat.submat(mat.rows() - imread.rows(), mat.rows(), mat.cols() - imread.cols(), mat.cols()); break; default: mat2 = null; break; } imread.copyTo(mat2); mat2.release(); imread.release(); new File(str).delete(); } static int calcLayout4in1(int i, boolean z, boolean z2, int i2) { Mat mat; int i3; int i4 = i; boolean z3 = z; boolean z4 = z2; Mat mat2 = new Mat(2, 2, CvType.CV_8UC1, Scalar.all(0.0d)); if (i4 == 131072) { mat2.put(0, 0, 0.0d); mat2.put(0, 1, 1.0d); mat2.put(1, 0, 2.0d); mat2.put(1, 1, 3.0d); } else if (i4 == 262144) { mat2.put(0, 0, 0.0d); mat2.put(0, 1, 2.0d); mat2.put(1, 0, 1.0d); mat2.put(1, 1, 3.0d); } new Mat(); if (z3 && !z4) { mat = mat2.mo42753t(); Core.flip(mat, mat, 0); } else if (z3 || !z4) { mat = mat2.clone(); } else { mat = mat2.mo42753t(); Core.flip(mat, mat, 1); } mat2.release(); int i5 = 0; loop0: while (true) { if (i5 >= mat.rows()) { i5 = 0; i3 = 0; break; } i3 = 0; while (i3 < mat.cols()) { if ((mat.get(i5, i3)[0]) == i2) { break loop0; } i3++; } int i6 = i2; i5++; } mat.release(); if (i5 == 0) { if (i3 != 0 && i3 == 1) { return 1; } return 0; } else if (i5 != 1) { return 0; } else { if (i3 == 0) { return 2; } if (i3 == 1) { return 3; } return 0; } } } public int createJpegImage(EPImage ePImage, int i) { int i2; synchronized (lockObject) { try { epsonImage epsonimage = new epsonImage(); String path = new File(ExternalFileUtils.getInstance(mContext).getPrintDir(), ePImage.loadImageFileName.substring(ePImage.loadImageFileName.lastIndexOf(47) + 1)).getPath(); String str = path.substring(0, path.lastIndexOf(46)) + ".jpg"; i2 = epsonimage.bmp2Jpg2(ePImage.decodeImageFileName, str); ePImage.decodeImageFileName = str; } catch (Exception e) { e.printStackTrace(); ePImage.decodeImageFileName = null; i2 = -1; } } return i2; } private String rotate(EPImage ePImage, int i, int i2) { String str = ePImage.decodeImageFileName; String tempViewDir = ExternalFileUtils.getInstance(mContext).getTempViewDir(); String path = new File(tempViewDir, "rotate_" + ePImage.rotate + CommonDefine.UNDER_BAR + (ePImage.index + 1) + ".bmp").getPath(); ePImage.rotate = ePImage.rotate % 360; if (ePImage.rotate == 0) { return ePImage.decodeImageFileName; } if (ePImage.rotate == 90 || ePImage.rotate == 270) { int i3 = ePImage.decodeWidth; ePImage.decodeWidth = ePImage.decodeHeight; ePImage.decodeHeight = i3; int i4 = ePImage.previewWidth; ePImage.previewWidth = ePImage.previewHeight; ePImage.previewHeight = i4; } int i5 = ePImage.rotate; if (i5 == 90) { int i6 = src.left; src.left = (ePImage.decodeWidth - 1) - src.bottom; Rect rect = src; rect.bottom = rect.right; src.right = (ePImage.decodeWidth - 1) - src.top; src.top = i6; } else if (i5 == 180) { int i7 = src.left; src.left = (ePImage.decodeWidth - 1) - src.right; src.right = (ePImage.decodeWidth - 1) - i7; int i8 = src.top; src.top = (ePImage.decodeHeight - 1) - src.bottom; src.bottom = (ePImage.decodeHeight - 1) - i8; } else if (i5 == 270) { int i9 = src.left; Rect rect2 = src; rect2.left = rect2.top; src.top = (ePImage.decodeHeight - 1) - src.right; Rect rect3 = src; rect3.right = rect3.bottom; src.bottom = (ePImage.decodeHeight - 1) - i9; } util.rotateImage(str, path, ePImage.rotate); ePImage.decodeImageFileName = path; return ePImage.decodeImageFileName; } public String writeDate(EPImage ePImage, int i, int i2, String str, int i3, boolean z) { int i4; int i5; EPImage ePImage2 = ePImage; String str2 = str; boolean z2 = z; String path = new File(ExternalFileUtils.getInstance(mContext).getPrintDir(), "date_" + (ePImage2.index + 1) + ".bmp").getPath(); int fontSize = getFontSize(i3); if (str2 != null) { try { int length = str.length() * fontSize; EPLog.v("drawTextToImage", "font_size=" + fontSize + " width=" + length + " height=" + fontSize); if (length <= 0 || fontSize <= 0) { throw new Exception(); } Paint paint = new Paint(1); paint.setColor(Color.rgb(226, 102, 10)); paint.setShadowLayer(1.0f, 2.0f, 2.0f, ViewCompat.MEASURED_STATE_MASK); float f = (float) fontSize; paint.setTextSize(f); paint.setTextAlign(Paint.Align.RIGHT); EPLog.i("drawTextToImage", "strDateTime = " + str2); int i6 = length * fontSize; int[] iArr = new int[i6]; int i7 = 0; for (int i8 = 0; i8 < i6; i8++) { iArr[i8] = -1; } Bitmap createBitmap = Bitmap.createBitmap(iArr, length, fontSize, Bitmap.Config.ARGB_8888); if (createBitmap != null) { Bitmap copy = createBitmap.copy(Bitmap.Config.ARGB_8888, true); if (copy != null) { createBitmap.recycle(); Canvas canvas = new Canvas(copy); Paint.FontMetrics fontMetrics = paint.getFontMetrics(); float f2 = (fontMetrics.descent - fontMetrics.ascent) - f; canvas.drawText(str2, ((float) length) - f2, f - f2, paint); Bitmap copy2 = copy.copy(Bitmap.Config.ARGB_8888, false); if (copy2 != null) { copy.recycle(); new BMPFile().saveBitmap(path, copy2, copy2.getWidth(), copy2.getHeight()); String str3 = ePImage2.decodeImageFileName; String path2 = new File(ExternalFileUtils.getInstance(mContext).getPrintDir(), "date2_" + (ePImage2.index + 1) + ".bmp").getPath(); int i9 = ePImage2.rotate; if (i9 == 0) { i7 = (i - copy2.getWidth()) - 1; i4 = (i2 - copy2.getHeight()) - 1; if (z2) { i7 = (i7 - 36) - 42; i4 = (i4 - 72) - 42; } } else if (i9 == 90) { int width = (i2 - copy2.getWidth()) - 1; if (z2) { width = (width - 72) - 42; i7 = 78; } util.rotateR90Image(path, path2); path = path2; } else if (i9 == 180) { if (z2) { i4 = 114; i7 = 78; } else { i4 = 0; } util.rotate180Image(path, path2); path = path2; } else if (i9 != 270) { i4 = 0; } else { int height = (i - copy2.getHeight()) - 1; if (z2) { i5 = 82; i7 = (height - 36) - 42; } else { i7 = height; i5 = 0; } util.rotateR270Image(path, path2); i4 = i5; path = path2; } util.writeDate(str3, path, i7, i4); ePImage2.decodeImageFileName = str3; return ePImage2.decodeImageFileName; } throw new Exception(); } throw new Exception(); } throw new Exception(); } catch (Exception e) { e.printStackTrace(); } } else { throw new Exception(); } } private synchronized void makeCancelFile() { try { new File(CANCEL_FILE_NAME).createNewFile(); EPLog.d("EPImageCreator", "EPImageCreator::makeCancelFile() create cancel file done."); } catch (IOException e) { EPLog.e("EPImageCreator", "error. can not create cancel_file. " + e); } return; } private synchronized void deleteCancelFile() { try { new File(CANCEL_FILE_NAME).delete(); } catch (SecurityException e) { EPLog.e("EPImageCreator", e.toString()); } return; } }