All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.multiplatform.loader.ResourceLoader.kt Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
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?
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy