31 lines
1.1 KiB
Java
31 lines
1.1 KiB
Java
package com.bumptech.glide.load.resource.transcode;
|
|
|
|
import android.graphics.Bitmap;
|
|
import com.bumptech.glide.load.Options;
|
|
import com.bumptech.glide.load.engine.Resource;
|
|
import com.bumptech.glide.load.resource.bytes.BytesResource;
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class BitmapBytesTranscoder implements ResourceTranscoder<Bitmap, byte[]> {
|
|
private final Bitmap.CompressFormat a;
|
|
private final int b;
|
|
|
|
public BitmapBytesTranscoder() {
|
|
this(Bitmap.CompressFormat.JPEG, 100);
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.transcode.ResourceTranscoder
|
|
public Resource<byte[]> a(Resource<Bitmap> resource, Options options) {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
resource.get().compress(this.a, this.b, byteArrayOutputStream);
|
|
resource.a();
|
|
return new BytesResource(byteArrayOutputStream.toByteArray());
|
|
}
|
|
|
|
public BitmapBytesTranscoder(Bitmap.CompressFormat compressFormat, int i) {
|
|
this.a = compressFormat;
|
|
this.b = i;
|
|
}
|
|
}
|