aboutsummaryrefslogtreecommitdiffstats
path: root/liblss16_encode_from_colour_index.3
blob: 9a55c093330392c49591e1ac7d40823b4562b5c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.TH LIBLSS16_ENCODE_FROM_COLOUR_INDEX 3 LIBLSS16
.SH NAME
liblss16_encode_from_colour_index \- Encode an LSS16 image file

.SH SYNOPSIS
.nf
#include <liblss16.h>

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)