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

commonMain.graphics.RawImage.kt Maven / Gradle / Ivy

The newest version!
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..




© 2015 - 2024 Weber Informatics LLC | Privacy Policy