aboutsummaryrefslogtreecommitdiffstats
path: root/libcolour_convert.3
blob: d9c60422831a40261556603d92348aa81f2f5ab7 (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
.TH LIBCOLOUR_CONVERT 3 libcolour
.SH NAME
libcolour_convert - Colour space and colour model conversion
.SH SYNOPSIS
.nf
#include <libcolour.h>

int \fBlibcolour_convert_f\fP(const libcolour_colour_f_t *restrict \fIfrom\fP,
                        libcolour_colour_f_t *restrict \fIto\fP);
int \fBlibcolour_convert_lf\fP(const libcolour_colour_lf_t *restrict \fIfrom\fP,
                         libcolour_colour_lf_t *restrict \fIto\fP);
int \fBlibcolour_convert_llf\fP(const libcolour_colour_llf_t *restrict \fIfrom\fP,
                          libcolour_colour_llf_t *restrict \fIto\fP);

#define \fBlibcolour_convert\fP(\fIfrom\fP, \fIto\fP)\\
	(_Generic((\fIfrom\fP),\\
	          libcolour_colour_f_t *:   \fBlibcolour_convert_f\fP(\fIfrom\fP, \fIto\fP),\\
	          libcolour_colour_lf_t *:  \fBlibcolour_convert_lf\fP(\fIfrom\fP, \fIto\fP),\\
	          libcolour_colour_llf_t *: \fBlibcolour_convert_llf\fP(\fIfrom\fP, \fIto\fP)))
	          /* list is incomplete */
.fi
.SH DESCRIPTION
.B libcolour_convert
and its non-generic functions converts the colour
stored in
.I from
to the colour space specified in
.I to
and stores the new colour values in
.IR to .
Additionally, the the transfer function is applied
or unapplied if specified differently in
.I from
and
.IR to .
.SH RETURN VALUES
Upon successful completion, the functions returns 0.
Otherwise the function return -1 with
.I errno
set to indicate the error.
.SH ERRORS
.TP
.B EINVAL
.I from->model
or
.I to->model
does not refer to a recognised colour model.
.SH NOTES
.B libcolour_convert
cannot convert between
.BR float ,
.BR double ,
and
.BR long\ double ,
.I from
and
.I to
most use the same floating-point type.
.SH SEE ALSO
.BR libcolour (7),
.BR libcolour_convert_en_masse (3)
.SH AUTHORS
Mattias Andrée
.RI < m@maandree.se >