Region Decoder Image Source
ImageSource that decodes regions of an encoded image (JPEG, PNG or WebP) using a BitmapRegionDecoder, so the whole image never needs to be held in memory.
The encoded image is read through opener, which is invoked each time the source needs to read the image: once to read the EXIF orientation and once to open the region decoder, both on creation and on every contentChanged call. Streams returned by opener are always closed by this class.
A region decoder created from a stream keeps a copy of the whole encoded image in memory. The factories in ImageSources avoid that copy for files and file backed URIs.
Creating an instance reads the image header, so it should be done away from the UI thread when the image is large or comes from a slow provider.
Throws
if the image cannot be read or its format is not supported by BitmapRegionDecoder.
Properties
EXIF orientation of the image, or ExifInterface.ORIENTATION_NORMAL when it is unknown.
Height of the image in stored pixels, before applying orientation.
Width of the image in stored pixels, before applying orientation.
Functions
Releases the region decoder. Further calls to decodeRegion return null.
Re-reads the image through the opener, closing the previous region decoder.
Decodes a region of the image.