Package 

Class ImageDecoderResourceDecoder

    • Method Summary

      Modifier and Type Method Description
      final boolean handles(@NonNull() ImageDecoder.Source source, @NonNull() Options options) Returns {@code true} if this decoder is capable of decoding the given source with the givenoptions, and {@code false} otherwise.
      final Resource<T> decode(@NonNull() ImageDecoder.Source source, int requestedWidth, int requestedHeight, @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
    • Method Detail

      • handles

         final boolean handles(@NonNull() ImageDecoder.Source 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() final Resource<T> decode(@NonNull() ImageDecoder.Source source, int requestedWidth, int requestedHeight, @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.
        options - A map of string keys to objects that may or may not contain options available tothis particular implementation.