ImageDecoder.java 1.0 KB

12345678910111213141516171819202122232425262728
  1. package com.davemorrissey.labs.subscaleview.decoder;
  2. import android.content.Context;
  3. import android.graphics.Bitmap;
  4. import android.graphics.Point;
  5. import android.graphics.Rect;
  6. import android.net.Uri;
  7. /**
  8. * Interface for image decoding classes, allowing the default {@link android.graphics.BitmapRegionDecoder}
  9. * based on the Skia library to be replaced with a custom class.
  10. */
  11. public interface ImageDecoder {
  12. /**
  13. * Decode an image. When possible, initial setup work once in this method. This method
  14. * must return the dimensions of the image. The URI can be in one of the following formats:
  15. * File: file:///scard/picture.jpg
  16. * Asset: file:///android_asset/picture.png
  17. * Resource: android.resource://com.example.app/drawable/picture
  18. * @param context Application context. A reference may be held, but must be cleared on recycle.
  19. * @param uri URI of the image.
  20. * @return Dimensions of the image.
  21. * @throws Exception if initialisation fails.
  22. */
  23. Bitmap decode(Context context, Uri uri) throws Exception;
  24. }