KiteAsyncImage

@Composable
fun KiteAsyncImage(model: Any?, contentDescription: String?, modifier: Modifier = Modifier, imageLoader: ImageLoader = SingletonImageLoader.get(LocalPlatformContext.current), alignment: Alignment = Alignment.Center, contentScale: ContentScale = ContentScale.Fit, alpha: Float = DefaultAlpha, colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DrawScope.DefaultFilterQuality, animate: Boolean = true, placeholder: Painter? = null, error: Painter? = null, onSuccess: (SuccessResult) -> Unit? = null, onError: (ErrorResult) -> Unit? = null)(source)

AsyncImage, but animations actually play: on every target.

Coil does what Coil is for: model goes through its full pipeline (network fetchers, disk cache, memory cache, request lifecycle) via imageLoader. Rendering is ours. When the result is a KiteAnimationImage (produced by a registered KiteImageDecoder), this composable plays it with KiteAnimatedImage's elapsed-time frame loop: per-frame delays, loop count, last-frame hold and no drift. That composable lives in imagekodec-compose, which this module depends on as implementation, so declare it yourself if you want to call it directly. Any other result renders exactly as AsyncImage would, via Image.asPainter.

The request carries this composable's layout constraints as its target size, while ContentScale.None requests the original pixels. Drawing scales map to Coil's FIT/FILL policy; an ImageRequest's explicit size and scale take precedence, so KiteImageDecoder downscales still images and every animation frame to what will actually be drawn. A still JPEG, JPEG 2000 or JPEG XR also decodes at a reduced size inside its inverse transform, and a HEIC or AVIF grid one row of tiles at a time, so a photo in an avatar slot never exists at wallpaper size; other formats decode in full first and keep only the downscaled pixels. HEIC (HEVC) needs the imagekodec-heic module and a call to ImageKodecHeic.install() at startup; without it Coil's platform decoder gets the file.

model may be anything Coil accepts as data, or a prebuilt ImageRequest (with size and scale inferred from contentScale when not explicitly set). animate pins animated results to their first frame when false, and then the request asks for that frame alone through maxFrames unless model sets its own, so a grid of paused thumbnails decodes one frame of each. Turning it on requests every frame while the pinned one stays up; turning it off once every frame is there pins the first without another request. placeholder shows while the request is in flight. On failure, error overrides the request's error image; when absent, that image is displayed. onSuccess / onError fire once per completed request.