aboutsummaryrefslogtreecommitdiff
path: root/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.java')
-rw-r--r--library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.java
new file mode 100644
index 0000000..004f875
--- /dev/null
+++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.java
@@ -0,0 +1,29 @@
+package com.davemorrissey.labs.subscaleview.decoder;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.net.Uri;
+
+/**
+ * Interface for image decoding classes, allowing the default {@link android.graphics.BitmapFactory}
+ * based on the Skia library to be replaced with a custom class.
+ */
+public interface ImageDecoder {
+
+ /**
+ * Decode an image. The URI can be in one of the following formats:
+ * <br>
+ * File: <code>file:///scard/picture.jpg</code>
+ * <br>
+ * Asset: <code>file:///android_asset/picture.png</code>
+ * <br>
+ * Resource: <code>android.resource://com.example.app/drawable/picture</code>
+ *
+ * @param context Application context
+ * @param uri URI of the image
+ * @return the decoded bitmap
+ * @throws Exception if decoding fails.
+ */
+ Bitmap decode(Context context, Uri uri) throws Exception;
+
+}