1bcf4a0dae04a4ad14287eeb34069a97c96fe9bb1Sam Juddpackage com.bumptech.glide.load.resource.bitmap;
20ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd
30ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Juddimport android.graphics.Bitmap;
49fc12334a7d14347cd6951d0653264b2597bd3a0Sam Juddimport com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
59fc12334a7d14347cd6951d0653264b2597bd3a0Sam Juddimport com.bumptech.glide.load.DecodeFormat;
60ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd
70ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd/**
80ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * A bitmap decoder for a given resource type.
90ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd *
100ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * @param <T> The type of resource this decoder can decode a {@link Bitmap} from.
110ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd */
120ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Juddpublic interface BitmapDecoder<T> {
130ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd    /**
140ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     * Returns a decoded bitmap for a given resource and target dimensions.
150ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     *
160ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     * @param resource The resource to decode.
170ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     * @param bitmapPool A bitmap pool that can be used to reuse bitmaps during the load. Any bitmaps created or
180ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     *                   obtained from the pool other than the bitmap returned by this method should be returned to the
190ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     *                   pool.
200ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     * @param outWidth The target width for the returned bitmap (need not match exactly).
2176fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd     * @param outHeight The target height for the returned bitmap (need not match exactly).
2276fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd     * @param decodeFormat The desired configuration for the returned bitmap.
230ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     */
2476fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd    public Bitmap decode(T resource, BitmapPool bitmapPool, int outWidth, int outHeight, DecodeFormat decodeFormat)
2576fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd            throws Exception;
260ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd
270ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd    /**
280ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     * Returns some unique String id that distinguishes this decoder from any other decoder.
290ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd     */
300ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd    public String getId();
310ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd}
32