1package com.bumptech.glide.load.resource.bitmap; 2 3import android.graphics.Bitmap; 4import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 5import com.bumptech.glide.load.DecodeFormat; 6 7/** 8 * A bitmap decoder for a given resource type. 9 * 10 * @param <T> The type of resource this decoder can decode a {@link Bitmap} from. 11 */ 12public interface BitmapDecoder<T> { 13 /** 14 * Returns a decoded bitmap for a given resource and target dimensions. 15 * 16 * @param resource The resource to decode. 17 * @param bitmapPool A bitmap pool that can be used to reuse bitmaps during the load. Any bitmaps created or 18 * obtained from the pool other than the bitmap returned by this method should be returned to the 19 * pool. 20 * @param outWidth The target width for the returned bitmap (need not match exactly). 21 * @param outHeight The target height for the returned bitmap (need not match exactly). 22 * @param decodeFormat The desired configuration for the returned bitmap. 23 */ 24 public Bitmap decode(T resource, BitmapPool bitmapPool, int outWidth, int outHeight, DecodeFormat decodeFormat) 25 throws Exception; 26 27 /** 28 * Returns some unique String id that distinguishes this decoder from any other decoder. 29 */ 30 public String getId(); 31} 32