aboutsummaryrefslogtreecommitdiffstats
path: root/libquanta_palette_size.3
blob: 146bde3f776030f74c38cf22addd6ae12d033ba3 (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
.TH LIBQUANTA_PALETTE_SIZE 3 libquanta
.SH NAME
libquanta_palette_size \- Calculate allocation size of palette

.SH SYNPOSIS
.nf
#include <libquanta.h>

int \fBlibquanta_palette_size\fP(size_t \fIncolours\fP, size_t \fInchannels\fP, size_t *\fIsize_out\fP);
.fi
.PP
Link with
.IR -lquanta .

.SH DESCRIPTION
The
.BR libquanta_palette_size ()
function calculates the allocation size for a
.I struct libquanta_palette
whuch may hold
.I ncolours
colours, each with
.I nchannels
primary colours. The size is stored in
.I *size_out
unless
.I size_out
is
.IR NULL .
.PP
.I ncolours
shall be the maximum number of colours the palette may hold.
Must be at least 1.
.PP
.I nchannels
shall be the number of colour channels in the image.
Must be at least 1.

.SH RETURN VALUE
Upon successful completion, the
.BR libquanta_palette_size ()
function returns 0.
On failure, the function return -1 and set
.I errno
to indicate the error.

.SH ERRORS
The
.BR libquanta_palette_size ()
function may fail if:
.TP
.B EINVAL
.I ncolours
or
.I nchannels
is 0.
.TP
.B EOVERFLOW
The palette is too large to be allocated
because the require size exceeds the maximum
allocation size for the platform.

.SH SEE ALSO
.BR libquanta (7),
.BR libquanta_malloc_palette (3),
.BR libquanta_quantise (3)