.TH LIBLSS16_ENCODE_FROM_COLOUR_INDEX 3 LIBLSS16 .SH NAME liblss16_encode_from_colour_index \- Encode an LSS16 image file .SH SYNOPSIS .nf #include enum liblss16_encode_state { LIBLSS16_ENCODE_RUNNING, LIBLSS16_ENCODE_DONE }; struct liblss16_encoder { /* fields omitted */ }; enum liblss16_encode_state liblss16_encode_from_colour_index( struct liblss16_encoder *\fIencoder\fP, void *\fIbuffer\fP, size_t \fIsize\fP, size_t *\fIwritten_out\fP, const uint8_t *\fIpixels\fP, size_t \fInpixels\fP, size_t *\fInconsumed_out\fP); .fi .PP Link with .IR -llss16 . .SH DESCRIPTION The .BR liblss16_encode_from_colour_index () function encodes an image as in LSS16 file. Before beginning the encoding, the application must first initalise .I encoder with its initial state and image meta data using the .BR liblss16_encoder_init (3) function. After than, the .BR liblss16_encode_from_colour_index () function is called repeatedly until it returns .BR LIBLSS16_ENCODE_DONE . .PP The application shall provide an array of pixels in the .I pixels parameter, with the number of provided pixels specified in the .I npixels parameter. After each call, the application shall discard the first .I *nconsumed_out pixels but may append additional pixels. .I npixels shall be decreased by .I *nconsumed_out and increased by the number of new pixels. The application shall also provide a file content output buffer in the .I buffer parameter and the size, in bytes, of the buffer in the .I size parameter. After each call, the application shall shall write the first .I *written_out bytes from .I buffer to the output file. .PP .IR encoder , .IR buffer , .IR written_out , and .IR nconsumed_out must not be .IR NULL , and .I size must be at least 1. .PP .I pixels may only be .I NULL if .I npixels is 0. .SH RETURN VALUE The .BR liblss16_encode_from_colour_index () function returns .B LIBLSS16_ENCODE_RUNNING until the last byte for the LSS16 file hsa been written. Once the last byte has been written, it returns .BR LIBLSS16_ENCODE_DONE . Note that .I *written_out and .I *nconsumed_out are always set. .SH ERRORS The .BR liblss16_encode_from_colour_index () function cannot fail. .SH SEE ALSO .BR liblss16_encode_strerror (3), .BR liblss16_decode_to_colour_index (3), .BR liblss16 (7)