forked from DylanVann/react-native-fast-image
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitmapSizeTranscoder.java
More file actions
23 lines (19 loc) · 821 Bytes
/
BitmapSizeTranscoder.java
File metadata and controls
23 lines (19 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.dylanvann.fastimage;
import android.graphics.BitmapFactory;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.SimpleResource;
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
public class BitmapSizeTranscoder implements ResourceTranscoder<BitmapFactory.Options, Size> {
@Nullable
@Override
public Resource<Size> transcode(@NonNull Resource<BitmapFactory.Options> toTranscode, @NonNull Options options) {
BitmapFactory.Options bitmap = toTranscode.get();
Size size = new Size();
size.width = bitmap.outWidth;
size.height = bitmap.outHeight;
return new SimpleResource(size);
}
}