Support in-memory caching for non-bitmap drawables.
colinrtwhite opened this issue · comments
Is your feature request related to a problem? Please describe.
Coil's memory cache currently only supports storing Bitmap
s. Notably, animated drawables (e.g. AnimatedImageDrawable
and MovieDrawable
) cannot be stored in the MemoryCache
and must be re-decoded for each new image request.
Describe the solution you'd like
Support storing non-bitmap Drawable
s in MemoryCache
.
Additional context
Any solution will likely have to be opt-in since unlike (immutable) Bitmap
s, which can be used by multiple targets at the same time, animated drawables are often stateful and can't be used by multiple targets at the same time. This mean we need to remove the drawable from the memory cache when it's in-use and only re-add it once the Target
finishes using it. Additionally, parameters like AnimationCallbacks
and other listeners will have to be added to the memory cache key.
Would this issue also add support for AnimatedSVGs in AsyncImage with the SVGDecoder?
Any update on this?
Support storing NinePatchDrawable
in MemoryCache