1 package com.davemorrissey.labs.subscaleview.decoder; 2 3 import android.content.Context; 4 import android.graphics.Bitmap; 5 import android.net.Uri; 6 7 /** 8 * Interface for image decoding classes, allowing the default {@link android.graphics.BitmapFactory} 9 * based on the Skia library to be replaced with a custom class. 10 */ 11 public interface ImageDecoder { 12 13 /** 14 * Decode an image. The URI can be in one of the following formats: 15 * <br> 16 * File: <code>file:///scard/picture.jpg</code> 17 * <br> 18 * Asset: <code>file:///android_asset/picture.png</code> 19 * <br> 20 * Resource: <code>android.resource://com.example.app/drawable/picture</code> 21 * 22 * @param context Application context 23 * @param uri URI of the image 24 * @return the decoded bitmap 25 * @throws Exception if decoding fails. 26 */ decode(Context context, Uri uri)27 Bitmap decode(Context context, Uri uri) throws Exception; 28 29 } 30