Added in API level 28

Source


abstract class Source
kotlin.Any
   ↳ android.graphics.ImageDecoder.Source

Source of encoded image data.

References the data that will be used to decode a Drawable or Bitmap in #decodeDrawable or #decodeBitmap. Constructing a Source (with one of the overloads of createSource) can be done on any thread because the construction simply captures values. The real work is done in #decodeDrawable or #decodeBitmap.

A Source object can be reused to create multiple versions of the same image. For example, to decode a full size image and its thumbnail, the same Source can be used once with no OnHeaderDecodedListener and once with an implementation of onHeaderDecoded that calls setTargetSize with smaller dimensions. One Source can even be used simultaneously in multiple threads.

Summary