fun check()

in plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/util/pngj/chunks/PngChunkIHDR.kt [102:112]


    fun check() {
        if (cols < 1 || rows < 1 || compmeth != 0 || filmeth != 0) throw PngjInputException("bad IHDR: col/row/compmethod/filmethod invalid")
        if (bitspc != 1 && bitspc != 2 && bitspc != 4 && bitspc != 8 && bitspc != 16) throw PngjInputException("bad IHDR: bitdepth invalid")
        if (interlaced < 0 || interlaced > 1) throw PngjInputException("bad IHDR: interlace invalid")
        when (colormodel) {
            0 -> {}
            3 -> if (bitspc == 16) throw PngjInputException("bad IHDR: bitdepth invalid")
            2, 4, 6 -> if (bitspc != 8 && bitspc != 16) throw PngjInputException("bad IHDR: bitdepth invalid")
            else -> throw PngjInputException("bad IHDR: invalid colormodel")
        }
    }