parse

fun parse(text: String): CubeLut(source)

Parses the text of a .cube file.

Comments, a TITLE, and DOMAIN_MIN and DOMAIN_MAX are read, or LUT_3D_INPUT_RANGE in their place. A domain other than 0 to 1 is applied by reading the file's table onto a grid over 0 to 1, of at least 65 points. An entry outside 0 to 1 is held at the end it passed, since an SDR code stops there. A line can end in LF, CRLF or a lone CR.

The parse runs on the calling thread and takes time in proportion to the text, so a large file belongs off the main thread.

Throws

when the text holds a 1D table, a size outside MIN_SIZE to MAX_SIZE, a line that is neither a known keyword nor three finite numbers, the wrong number of entries, or more than MAX_CUBE_CHARS characters.