package d.d.a.j; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import cn.jiguang.net.HttpUtils; import com.flb.zj.omkxm.R; import com.fob.ds.base.DSApplication; import d.d.a.g.c; import d.e.b.a; import d.e.b.b0.c.f; import d.e.b.g; import d.e.b.k; import d.e.b.u; import d.e.b.w.b; import java.util.HashMap; public final class f0 { private static Bitmap a(Bitmap bitmap, Bitmap bitmap2) { if (bitmap == null) { return null; } if (bitmap2 == null) { return bitmap; } int width = bitmap.getWidth(); int height = bitmap.getHeight(); int width2 = bitmap2.getWidth(); int height2 = bitmap2.getHeight(); if (width == 0 || height == 0) { return null; } if (width2 == 0 || height2 == 0) { return bitmap; } float f2 = ((((float) width) * 1.0f) / 5.0f) / ((float) width2); Bitmap createBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); try { Canvas canvas = new Canvas(createBitmap); canvas.drawBitmap(bitmap, 0.0f, 0.0f, (Paint) null); canvas.scale(f2, f2, (float) (width / 2), (float) (height / 2)); canvas.drawBitmap(bitmap2, (float) ((width - width2) / 2), (float) ((height - height2) / 2), (Paint) null); canvas.save(); canvas.restore(); return createBitmap; } catch (Exception e2) { e2.getStackTrace(); return null; } } public static final Bitmap b(String str) { try { if (str.startsWith("data:image/png;base64,")) { str = str.replace("data:image/png;base64,", ""); c.c("Base64图片截取,开头:" + str); } else if (str.startsWith("data:image/jpeg;base64,")) { str = str.replace("data:image/jpeg;base64,", ""); c.c("Base64图片截取,开头:" + str); } else if (str.contains(",")) { String[] split = str.split(","); if (split.length > 1) { str = split[1]; c.c("Base64图片截取,逗号:" + str); } } byte[] a = f.a(str); return BitmapFactory.decodeByteArray(a, 0, a.length); } catch (Exception e2) { c.c("Base64图片转换失败:" + str); c.a(e2); return null; } } public static final Bitmap c(String str, int i, int i2) { try { HashMap hashMap = new HashMap(); hashMap.put(g.ERROR_CORRECTION, f.H); hashMap.put(g.CHARACTER_SET, HttpUtils.ENCODING_UTF_8); b a = new k().a(str, a.QR_CODE, i, i2, hashMap); int k = a.k(); int h = a.h(); int[] iArr = new int[(k * h)]; for (int i3 = 0; i3 < h; i3++) { for (int i4 = 0; i4 < k; i4++) { iArr[(i3 * k) + i4] = a.e(i4, i3) ? -16777216 : -1; } } Bitmap createBitmap = Bitmap.createBitmap(k, h, Bitmap.Config.ARGB_8888); createBitmap.setPixels(iArr, 0, k, 0, 0, k, h); return a(createBitmap, BitmapFactory.decodeResource(DSApplication.c().getResources(), R.drawable.ic_launcher)); } catch (u e2) { c.a(e2); return null; } } }