package expo.modules.interfaces.imageloader import android.graphics.Bitmap import expo.modules.kotlin.services.Service import java.util.concurrent.Future interface ImageLoaderInterface : Service { interface ResultListener { fun onSuccess(bitmap: Bitmap) fun onFailure(cause: Throwable?) } /** * Loads image into memory that might be cached and downsampled if necessary. */ fun loadImageForDisplayFromURL(url: String): Future /** * Loads image into memory that might be cached and downsampled if necessary. */ fun loadImageForDisplayFromURL(url: String, resultListener: ResultListener) /** * Loads full-sized image with no caching. */ fun loadImageForManipulationFromURL(url: String): Future /** * Loads full-sized image with no caching. */ fun loadImageForManipulationFromURL(url: String, resultListener: ResultListener) /** * Loads image with no caching, decoded to fit within `maxWidth`×`maxHeight` while preserving * the aspect ratio, so that large images don't need to be fully decoded into memory. * A `null` bound means the image keeps its original size on that axis. * Implementations that don't support bounded decoding fall back to the full-sized image. */ fun loadImageForManipulationFromURL(url: String, maxWidth: Int?, maxHeight: Int?, resultListener: ResultListener) = loadImageForManipulationFromURL(url, resultListener) }