diff options
| author | Mattias Andrée <m@maandree.se> | 2025-11-23 21:33:38 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2025-11-23 21:33:38 +0100 |
| commit | 226d807bb8bc0cdbc011b2e616ac02881e74c542 (patch) | |
| tree | e35bcc0f0b2bad8abfbb5da6db5580a813ca48bc /libquanta_malloc_palette.3 | |
| download | libquanta-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 '')
| -rw-r--r-- | libquanta_malloc_palette.3 | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/libquanta_malloc_palette.3 b/libquanta_malloc_palette.3 new file mode 100644 index 0000000..5523b4e --- /dev/null +++ b/libquanta_malloc_palette.3 @@ -0,0 +1,73 @@ +.TH LIBQUANTA_MALLOC_PALETTE 3 libquanta +.SH NAME +libquanta_malloc_palette \- Allocation a palette + +.SH SYNPOSIS +.nf +#include <libquanta.h> + +\fBstruct libquanta_palette\fP { + size_t \fIsize\fP; + uint64_t \fIpalette\fP[]; +}; + +struct libquanta_palette *\fBlibquanta_malloc_palette\fP(size_t \fIncolours\fP, size_t \fInchannels\fP); +.fi +.PP +Link with +.IR -lquanta . + +.SH DESCRIPTION +The +.BR libquanta_malloc_palette () +function allocates a new palette holding a maximum of +.I ncolours +colours, each with +.I nchannels +primary colours. +.PP +.I .size +in the structure refered to by the returned pointer will +be set to +.IR ncolours . +.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_malloc_palette () +function returns a pointer to newly palette. +The caller is responsable for deallocating the +memory, that the returned value points to, using the +.BR free (3) +function. +On failure, the function return +.I NULL +and set +.I errno +to indicate the error. + +.SH ERRORS +The +.BR libquanta_malloc_palette () +function may fail if: +.TP +.B EINVAL +.I ncolours +or +.I nchannels +is 0. +.TP +.B ENOMEM +Storage space available is insufficient. + +.SH SEE ALSO +.BR libquanta (7), +.BR libquanta_palette_size (3), +.BR libquanta_quantise (3) |
