commonMain.ru.casperix.multiplatform.loader.ResourceLoader.kt Maven / Gradle / Ivy
package ru.casperix.multiplatform.loader
import ru.casperix.renderer.pixel_map.PixelMap
import ru.casperix.signals.concrete.EitherFuture
import ru.casperix.signals.concrete.EitherSignal
expect val resourceLoader : AbstractResourceLoader
interface AbstractResourceLoader {
fun loadBytes(path: String): EitherFuture
fun loadText(path: String): EitherFuture {
val proxy = EitherSignal()
loadBytes(path).then({ bytes ->
proxy.accept(bytes.decodeToString())
}, {
proxy.reject(it)
})
return proxy
}
fun loadImage(path: String): EitherFuture
fun saveImage(path: String, pixelMap: PixelMap): ResourceSaveError?
}