1bcf4a0dae04a4ad14287eeb34069a97c96fe9bb1Sam Juddpackage com.bumptech.glide.load.resource.bitmap; 20ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd 30ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Juddimport android.graphics.Bitmap; 4f7a6d65cf7c1a41908dd48e0dab68ee5b881387eSam Judd 59fc12334a7d14347cd6951d0653264b2597bd3a0Sam Juddimport com.bumptech.glide.load.DecodeFormat; 6f7a6d65cf7c1a41908dd48e0dab68ee5b881387eSam Juddimport com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 70ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd 80ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd/** 90ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * A bitmap decoder for a given resource type. 100ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * 110ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * @param <T> The type of resource this decoder can decode a {@link Bitmap} from. 120ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd */ 130ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Juddpublic interface BitmapDecoder<T> { 140ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd /** 150ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * Returns a decoded bitmap for a given resource and target dimensions. 160ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * 1719611a3aaf2d45bb8274bdaabb4bf4b392e05feaRobert Papp * @param resource The resource to decode, managed by the caller, no need to clean it up. 180ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * @param bitmapPool A bitmap pool that can be used to reuse bitmaps during the load. Any bitmaps created or 190ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * obtained from the pool other than the bitmap returned by this method should be returned to the 200ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * pool. 210ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * @param outWidth The target width for the returned bitmap (need not match exactly). 2276fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd * @param outHeight The target height for the returned bitmap (need not match exactly). 2376fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd * @param decodeFormat The desired configuration for the returned bitmap. 240ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd */ 255ba19a0e69ad3a651b8f13ba45de48a56b56ce36Sam Judd Bitmap decode(T resource, BitmapPool bitmapPool, int outWidth, int outHeight, DecodeFormat decodeFormat) 2676fbad3dbce72240e9f5b82c826e3229c1176fb6Sam Judd throws Exception; 270ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd 280ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd /** 290ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd * Returns some unique String id that distinguishes this decoder from any other decoder. 305f4610b54d517be58105bcf73ce3291ba79f9f40Sam Judd * 315f4610b54d517be58105bcf73ce3291ba79f9f40Sam Judd * <p> 325f4610b54d517be58105bcf73ce3291ba79f9f40Sam Judd * This method can return the empty string if for all practical purposes it applies no transformations to the 335f4610b54d517be58105bcf73ce3291ba79f9f40Sam Judd * data while loading the resource. For {@link android.graphics.Bitmap}s this would mean at a minimum doing no 345f4610b54d517be58105bcf73ce3291ba79f9f40Sam Judd * downsampling and also probably always producing {@link android.graphics.Bitmap}s with 355f4610b54d517be58105bcf73ce3291ba79f9f40Sam Judd * {@link android.graphics.Bitmap.Config#ARGB_8888} as their config. 365f4610b54d517be58105bcf73ce3291ba79f9f40Sam Judd * </p> 370ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd */ 385ba19a0e69ad3a651b8f13ba45de48a56b56ce36Sam Judd String getId(); 390ae32dc10d668a04f9f0484d587aefe5a7210e1cSam Judd} 40