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.0     , 1.0     , 0.0     , 1.0},
33                      {0.5     , 0.5     , 0.5     , 1.0},
34                      {0.0     , 1.0     , 1.0     , 1.0}};
35 
36   float cmyk[][4] = {{0.0,       0.0  ,   0.0  , 0.0},
37                      {1.0,       0.0  ,   1.0  , 0.0},
38                      {0.0,       0.0  ,   0.0  , 0.5},
39                      {1.0,       0.0  ,   0.0  , 0.0}};
40 
41   babl_init ();
42 
43   CHECK_CONV_FLOAT ("rgba to cmyk ", float, 0.001,
44                     babl_format ("RGBA float"),
45                     babl_format ("CMYK float"),
46                     rgba, cmyk);
47 
48   CHECK_CONV_FLOAT ("cmyk to rgba ", float, 0.001,
49                     babl_format ("CMYK float"),
50                     babl_format ("RGBA float"),
51                     cmyk, rgba);
52 
53   babl_exit ();
54 
55   return !OK;
56 }
57