aboutsummaryrefslogtreecommitdiffstats
path: root/libquanta_palette_size.3
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-11-23 21:33:38 +0100
committerMattias Andrée <m@maandree.se>2025-11-23 21:33:38 +0100
commit226d807bb8bc0cdbc011b2e616ac02881e74c542 (patch)
treee35bcc0f0b2bad8abfbb5da6db5580a813ca48bc /libquanta_palette_size.3
downloadlibquanta-226d807bb8bc0cdbc011b2e616ac02881e74c542.tar.gz
libquanta-226d807bb8bc0cdbc011b2e616ac02881e74c542.tar.bz2
libquanta-226d807bb8bc0cdbc011b2e616ac02881e74c542.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libquanta_palette_size.3')
-rw-r--r--libquanta_palette_size.366
1 files changed, 66 insertions, 0 deletions
diff --git a/libquanta_palette_size.3 b/libquanta_palette_size.3
new file mode 100644
index 0000000..146bde3
--- /dev/null
+++ b/libquanta_palette_size.3
@@ -0,0 +1,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)