commonMain.graphics.RawImage.kt Maven / Gradle / Ivy
package ch.softappeal.konapi.graphics
/** [bytes] is (red, green, blue) x width x height. */
public class RawImage(width: Int, height: Int, internal val bytes: ByteArray) : Dimension(width, height) {
init {
require(bytes.size == width * height * 3) { "bytes.size=${bytes.size} must be ${width * height * 3}" }
}
}
public fun Graphics.draw(xTopLeft: Int, yTopLeft: Int, image: RawImage): Unit = retainColor {
val bytes = image.bytes
var b = 0
for (y in yTopLeft..