Package 

Interface ImageRegionDecoder

    • Method Summary

      Modifier and Type Method Description
      abstract Point init(Context context, @NonNull() Uri uri) Initialise the decoder.
      abstract Bitmap decodeRegion(@NonNull() Rect sRect, int sampleSize) Decode a region of the image with the given sample size.
      abstract boolean isReady() Status check.
      abstract void recycle() This method will be called when the decoder is no longer required.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • init

        @NonNull() abstract Point init(Context context, @NonNull() Uri uri)

        Initialise the decoder. When possible, perform initial setup work once in this method. Thedimensions of the image must be returned. The URI can be in one of the following formats:File: file:///scard/picture.jpgAsset: file:///android_asset/picture.pngResource: android.resource://com.example.app/drawable/picture

        Parameters:
        context - Application context.
        uri - URI of the image.
      • decodeRegion

        @NonNull() abstract Bitmap decodeRegion(@NonNull() Rect sRect, int sampleSize)

        Decode a region of the image with the given sample size. This method is called off the UIthread so it can safely load the image on the current thread. It is called from android.os.AsyncTasks running in an executor that may have multiple threads, soimplementations must be thread safe. Adding synchronized to the method signatureis the simplest way to achieve this, but bear in mind the recycle method can becalled concurrently.

        See SkiaImageRegionDecoder and SkiaPooledImageRegionDecoder for examples ofinternal locking and synchronization.

        Parameters:
        sRect - Source image rectangle to decode.
        sampleSize - Sample size.
      • isReady

         abstract boolean isReady()

        Status check. Should return false before initialisation and after recycle.

      • recycle

         abstract void recycle()

        This method will be called when the decoder is no longer required. It should clean up any resources still in use.