正在查看: Plus 12 v10.13.1.1 应用的 Bitmaps.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 Bitmaps.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.messenger;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
public class Bitmaps {
private static volatile Matrix sScaleMatrix;
private static final ThreadLocal<byte[]> jpegData = new ThreadLocal<byte[]>() {
@Override
public byte[] initialValue() {
return new byte[]{-1, -40, -1, -37, 0, 67, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -64, 0, 17, 8, 0, 0, 0, 0, 3, 1, 34, 0, 2, 17, 0, 3, 17, 0, -1, -60, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, -60, 0, -75, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, -127, -111, -95, 8, 35, 66, -79, -63, 21, 82, -47, -16, 36, 51, 98, 114, -126, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, -125, -124, -123, -122, -121, -120, -119, -118, -110, -109, -108, -107, -106, -105, -104, -103, -102, -94, -93, -92, -91, -90, -89, -88, -87, -86, -78, -77, -76, -75, -74, -73, -72, -71, -70, -62, -61, -60, -59, -58, -57, -56, -55, -54, -46, -45, -44, -43, -42, -41, -40, -39, -38, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -1, -60, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, -60, 0, -75, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, -127, 8, 20, 66, -111, -95, -79, -63, 9, 35, 51, 82, -16, 21, 98, 114, -47, 10, 22, 36, 52, -31, 37, -15, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, -126, -125, -124, -123, -122, -121, -120, -119, -118, -110, -109, -108, -107, -106, -105, -104, -103, -102, -94, -93, -92, -91, -90, -89, -88, -87, -86, -78, -77, -76, -75, -74, -73, -72, -71, -70, -62, -61, -60, -59, -58, -57, -56, -55, -54, -46, -45, -44, -43, -42, -41, -40, -39, -38, -30, -29, -28, -27, -26, -25, -24, -23, -22, -14, -13, -12, -11, -10, -9, -8, -7, -6, -1, -38, 0, 12, 3, 1, 0, 2, 17, 3, 17, 0, 63, 0, -114, -118, 40, -96, 15, -1, -39};
}
};
public static byte[] header = {-1, -40, -1, -32, 0, 16, 74, 70, 73, 70, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, -1, -37, 0, 67, 0, 40, 28, 30, 35, 30, 25, 40, 35, 33, 35, 45, 43, 40, 48, 60, 100, 65, 60, 55, 55, 60, 123, 88, 93, 73, 100, -111, Byte.MIN_VALUE, -103, -106, -113, Byte.MIN_VALUE, -116, -118, -96, -76, -26, -61, -96, -86, -38, -83, -118, -116, -56, -1, -53, -38, -18, -11, -1, -1, -1, -101, -63, -1, -1, -1, -6, -1, -26, -3, -1, -8, -1, -37, 0, 67, 1, 43, 45, 45, 60, 53, 60, 118, 65, 65, 118, -8, -91, -116, -91, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -1, -64, 0, 17, 8, 0, 30, 0, 40, 3, 1, 34, 0, 2, 17, 1, 3, 17, 1, -1, -60, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, -60, 0, -75, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, -127, -111, -95, 8, 35, 66, -79, -63, 21, 82, -47, -16, 36, 51, 98, 114, -126, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, -125, -124, -123, -122, -121, -120, -119, -118, -110, -109, -108, -107, -106, -105, -104, -103, -102, -94, -93, -92, -91, -90, -89, -88, -87, -86, -78, -77, -76, -75, -74, -73, -72, -71, -70, -62, -61, -60, -59, -58, -57, -56, -55, -54, -46, -45, -44, -43, -42, -41, -40, -39, -38, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -1, -60, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, -60, 0, -75, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, -127, 8, 20, 66, -111, -95, -79, -63, 9, 35, 51, 82, -16, 21, 98, 114, -47, 10, 22, 36, 52, -31, 37, -15, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, -126, -125, -124, -123, -122, -121, -120, -119, -118, -110, -109, -108, -107, -106, -105, -104, -103, -102, -94, -93, -92, -91, -90, -89, -88, -87, -86, -78, -77, -76, -75, -74, -73, -72, -71, -70, -62, -61, -60, -59, -58, -57, -56, -55, -54, -46, -45, -44, -43, -42, -41, -40, -39, -38, -30, -29, -28, -27, -26, -25, -24, -23, -22, -14, -13, -12, -11, -10, -9, -8, -7, -6, -1, -38, 0, 12, 3, 1, 0, 2, 17, 3, 17, 0, 63, 0};
public static byte[] footer = {-1, -39};
public static Bitmap createBitmap(int width, int height, Bitmap.Config config) {
Bitmap createBitmap;
if (Build.VERSION.SDK_INT < 21) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inDither = true;
options.inPreferredConfig = config;
options.inPurgeable = true;
options.inSampleSize = 1;
options.inMutable = true;
byte[] bArr = jpegData.get();
bArr[76] = (byte) (height >> 8);
bArr[77] = (byte) (height & 255);
bArr[78] = (byte) (width >> 8);
bArr[79] = (byte) (width & 255);
createBitmap = BitmapFactory.decodeByteArray(bArr, 0, bArr.length, options);
Utilities.pinBitmap(createBitmap);
createBitmap.setHasAlpha(true);
createBitmap.eraseColor(0);
} else {
createBitmap = Bitmap.createBitmap(width, height, config);
}
if (config == Bitmap.Config.ARGB_8888 || config == Bitmap.Config.ARGB_4444) {
createBitmap.eraseColor(0);
}
return createBitmap;
}
private static void checkXYSign(int x, int y) {
if (x < 0) {
throw new IllegalArgumentException("x must be >= 0");
}
if (y < 0) {
throw new IllegalArgumentException("y must be >= 0");
}
}
private static void checkWidthHeight(int width, int height) {
if (width <= 0) {
throw new IllegalArgumentException("width must be > 0");
}
if (height <= 0) {
throw new IllegalArgumentException("height must be > 0");
}
}
public static Bitmap createBitmap(Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter) {
Bitmap createBitmap;
Paint paint;
int i = Build.VERSION.SDK_INT;
if (i >= 21) {
return Bitmap.createBitmap(source, x, y, width, height, m, filter);
}
checkXYSign(x, y);
checkWidthHeight(width, height);
int i2 = x + width;
if (i2 > source.getWidth()) {
throw new IllegalArgumentException("x + width must be <= bitmap.width()");
}
int i3 = y + height;
if (i3 > source.getHeight()) {
throw new IllegalArgumentException("y + height must be <= bitmap.height()");
}
if (!source.isMutable() && x == 0 && y == 0 && width == source.getWidth() && height == source.getHeight() && (m == null || m.isIdentity())) {
return source;
}
Canvas canvas = new Canvas();
Rect rect = new Rect(x, y, i2, i3);
RectF rectF = new RectF(0.0f, 0.0f, width, height);
Bitmap.Config config = Bitmap.Config.ARGB_8888;
Bitmap.Config config2 = source.getConfig();
if (config2 != null) {
int i4 = AnonymousClass2.$SwitchMap$android$graphics$Bitmap$Config[config2.ordinal()];
if (i4 == 1) {
config = Bitmap.Config.ARGB_8888;
} else if (i4 == 2) {
config = Bitmap.Config.ALPHA_8;
} else {
config = Bitmap.Config.ARGB_8888;
}
}
if (m == null || m.isIdentity()) {
createBitmap = createBitmap(width, height, config);
paint = null;
} else {
boolean z = !m.rectStaysRect();
RectF rectF2 = new RectF();
m.mapRect(rectF2, rectF);
int round = Math.round(rectF2.width());
int round2 = Math.round(rectF2.height());
if (z) {
config = Bitmap.Config.ARGB_8888;
}
createBitmap = createBitmap(round, round2, config);
canvas.translate(-rectF2.left, -rectF2.top);
canvas.concat(m);
paint = new Paint();
paint.setFilterBitmap(filter);
if (z) {
paint.setAntiAlias(true);
}
}
createBitmap.setDensity(source.getDensity());
createBitmap.setHasAlpha(source.hasAlpha());
if (i >= 19) {
createBitmap.setPremultiplied(source.isPremultiplied());
}
canvas.setBitmap(createBitmap);
canvas.drawBitmap(source, rect, rectF, paint);
try {
canvas.setBitmap(null);
} catch (Exception unused) {
}
return createBitmap;
}
public static class AnonymousClass2 {
public static final int[] $SwitchMap$android$graphics$Bitmap$Config;
static {
int[] iArr = new int[Bitmap.Config.values().length];
$SwitchMap$android$graphics$Bitmap$Config = iArr;
try {
iArr[Bitmap.Config.RGB_565.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$android$graphics$Bitmap$Config[Bitmap.Config.ALPHA_8.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$android$graphics$Bitmap$Config[Bitmap.Config.ARGB_4444.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$android$graphics$Bitmap$Config[Bitmap.Config.ARGB_8888.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
public static Bitmap createBitmap(Bitmap source, int x, int y, int width, int height) {
return createBitmap(source, x, y, width, height, null, false);
}
public static Bitmap createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter) {
Matrix matrix;
if (Build.VERSION.SDK_INT >= 21) {
return Bitmap.createScaledBitmap(src, dstWidth, dstHeight, filter);
}
synchronized (Bitmap.class) {
matrix = sScaleMatrix;
sScaleMatrix = null;
}
if (matrix == null) {
matrix = new Matrix();
}
int width = src.getWidth();
int height = src.getHeight();
matrix.setScale(dstWidth / width, dstHeight / height);
Bitmap createBitmap = createBitmap(src, 0, 0, width, height, matrix, filter);
synchronized (Bitmap.class) {
if (sScaleMatrix == null) {
sScaleMatrix = matrix;
}
}
return createBitmap;
}
}