You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

11 lines
438 B

package org.jetbrains.compose.animatedimage
import androidx.compose.ui.res.useResource
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
internal class ResourceAnimatedImageLoader(private val resourcePath: String) : AnimatedImageLoader() {
override suspend fun generateByteArray(): ByteArray = withContext(Dispatchers.IO) {
return@withContext useResource(resourcePath) { it.readAllBytes() }
}
}