[orx-dnk3, orx-runway] Use new loadImage interface

This commit is contained in:
Edwin Jakobs
2024-03-08 20:43:03 +01:00
parent ae3ad13703
commit 00776ae90d
2 changed files with 3 additions and 12 deletions

View File

@@ -22,18 +22,7 @@ fun ColorBuffer.toData(format: ImageFileFormat = ImageFileFormat.JPG): String {
return "data:image/jpeg;base64,$base64Data"
}
/**
* Construct a color buffer from a base64 data string
*/
fun ColorBuffer.Companion.fromData(data: String): ColorBuffer {
val decoder = Base64.getDecoder()
val commaIndex = data.indexOf(",")
val imageData = decoder.decode(data.drop(commaIndex + 1))
ByteArrayInputStream(imageData).use {
return ColorBuffer.fromStream(it)
}
}
/**
* Perform a Runway query