Package 

Class ParcelFileDescriptorBitmapDecoder

    • Method Summary

      Modifier and Type Method Description
      boolean handles(@NonNull() ParcelFileDescriptor source, @NonNull() Options options) Returns {@code true} if this decoder is capable of decoding the given source with the givenoptions, and {@code false} otherwise.
      Resource<Bitmap> decode(@NonNull() ParcelFileDescriptor source, int width, int height, @NonNull() Options options) Returns a decoded resource from the given data or null if no resource could be decoded.
      • Methods inherited from class com.mobwith.imgmodule.load.ResourceDecoder

        decode, handles
      • Methods inherited from class java.lang.Object

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

      • ParcelFileDescriptorBitmapDecoder

        ParcelFileDescriptorBitmapDecoder(Downsampler downsampler)
    • Method Detail

      • handles

         boolean handles(@NonNull() ParcelFileDescriptor source, @NonNull() Options options)

        Returns {@code true} if this decoder is capable of decoding the given source with the givenoptions, and {@code false} otherwise.

        Decoders should make a best effort attempt to quickly determine if they are likely to beable to decode data, but should not attempt to completely read the given data. A typicalimplementation would check the file headers verify they match content the decoder expects tohandle (i.e. a GIF decoder should verify that the image contains the GIF header block.

        Decoders that return {@code true} from {@code handles} may still return {@code null} from decode if the data is partial or formatted incorrectly.

      • decode

        @Nullable() Resource<Bitmap> decode(@NonNull() ParcelFileDescriptor source, int width, int height, @NonNull() Options options)

        Returns a decoded resource from the given data or null if no resource could be decoded.

        The {@code source} is managed by the caller, there's no need to close it. The returned Resource will be released when the engine sees fit.

        Note - The {@code width} and {@code height} arguments are hints only, there is norequirement that the decoded resource exactly match the given dimensions. A typical use casewould be to use the target dimensions to determine how much to downsample Bitmaps by to avoidoverly large allocations.

        Parameters:
        source - The data the resource should be decoded from.
        width - The ideal width in pixels of the decoded resource, or to indicate the original resourcewidth.
        height - The ideal height in pixels of the decoded resource, or to indicate the original resourceheight.
        options - A map of string keys to objects that may or may not contain options available tothis particular implementation.