1 /* babl - dynamically extendable universal pixel conversion library.
2  * Copyright (C) 2005, Øyvind Kolås.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 3 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General
15  * Public License along with this library; if not, see
16  * <https://www.gnu.org/licenses/>.
17  */
18 
19 #include "config.h"
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <assert.h>
23 #include "babl.h"
24 
25 #include "common.inc"
26 
27 
28 int
main(int argc,char ** argv)29 main (int    argc,
30       char **argv)
31 {
32   int OK = 1;
33   babl_init ();
34   {
35     float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.0, 1.0, 2.0, 3.0}};
36     unsigned char out[][4]  = {{ 55, 0, 0, 255 }, {0,255,255,255}};
37 
38     CHECK_CONV("float -> u8", unsigned char,
39         babl_format("R'G'B'A float"),
40         babl_format("R'G'B'A u8"),
41         in, out);
42   }
43 
44   babl_exit ();
45   return !OK;
46 }
47