1 /* babl - dynamically extendable universal pixel conversion library.
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 3 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General
14 * Public License along with this library; if not, see
15 * <https://www.gnu.org/licenses/>.
16 */
17
18 #include <stdio.h>
19
20 #include <babl/babl.h>
21
22 #include "common.inc"
23
24
25 int
main(int argc,char ** argv)26 main (int argc,
27 char **argv)
28 {
29 int OK = 1;
30
31 float rgba[][4] = {{1.0 , 1.0 , 1.0 , 1.0},
32 {0.214041, 0.214041, 0.214041, 1.0},
33 {0.0 , 0.0 , 0.0 , 1.0},
34 {1.0 , 0.0 , 0.0 , 1.0},
35 {0.522519, 0.522519, 0.0 , 1.0},
36 {0.0 , 0.214041, 0.0 , 1.0},
37 {0.214041, 1.0 , 1.0 , 1.0},
38 {0.214041, 0.214041, 1.0 , 1.0},
39 {0.522520, 0.050876, 0.522521, 1.0},
40 {0.353069, 0.372000, 0.017878, 1.0},
41 {0.052772, 0.010679, 0.823194, 1.0},
42 {0.012693, 0.414530, 0.052934, 1.0},
43 {0.870621, 0.579515, 0.004228, 1.0},
44 {0.453672, 0.029212, 0.781390, 1.0},
45 {0.850554, 0.181933, 0.081839, 1.0},
46 {0.995195, 0.941644, 0.244979, 1.0},
47 {0.009836, 0.595745, 0.308242, 1.0},
48 {0.036595, 0.019338, 0.315257, 1.0},
49 {0.209470, 0.207646, 0.478434, 1.0}};
50
51 float hsla[][4] = {{0.0, 0.0 , 1.0 , 1.0},
52 {0.0, 0.0 , 0.500, 1.0},
53 {0.0, 0.0 , 0.0 , 1.0},
54 {0.0, 1.0 , 0.500, 1.0},
55 {0.166667, 1.0 , 0.375, 1.0},
56 {0.333333, 1.0 , 0.250, 1.0},
57 {0.5, 1.0 , 0.750, 1.0},
58 {0.666666, 1.0 , 0.750, 1.0},
59 {0.833333, 0.500, 0.500, 1.0},
60 {0.171666, 0.638, 0.393, 1.0},
61 {0.6975, 0.832, 0.511, 1.0},
62 {0.374722, 0.707, 0.396, 1.0},
63 {0.1375, 0.893, 0.497, 1.0},
64 {0.788028, 0.775, 0.542, 1.0},
65 {0.039837, 0.817, 0.624, 1.0},
66 {0.158083, 0.991, 0.765, 1.0},
67 {0.451149, 0.779, 0.447, 1.0},
68 {0.689732, 0.601, 0.373, 1.0},
69 {0.668129, 0.290, 0.607, 1.0}};
70
71 babl_init ();
72
73 CHECK_CONV_FLOAT ("rgba to hsla ", float, 0.001,
74 babl_format ("RGBA float"),
75 babl_format ("HSLA float"),
76 rgba, hsla);
77
78 CHECK_CONV_FLOAT ("hsla to rgba ", float, 0.001,
79 babl_format ("HSLA float"),
80 babl_format ("RGBA float"),
81 hsla, rgba);
82
83 babl_exit ();
84
85 return !OK;
86 }
87