1 /* babl - dynamically extendable universal pixel conversion library.
2 * Copyright (C) 2012, Maxime Nicco <maxime.nicco@gmail.fr>
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.
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.
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/>.
20 * Adding test fo hsva colorspace
22 * The test is at 0.001 precision
39 float rgba
[][4] = {{ 1.0, 1.0, 1.0, 1.0 },
40 { 0.2140, 0.2140, 0.2140, 1.0 },
43 { 0.5209, 0.5225, 0, 1.0 },
44 { 0, 0.2140, 0, 1.0 },
45 { 0.2140, 1, 1, 1.0 },
46 { 0.2140, 0.2140, 1, 1.0 },
47 { 0.5215, 0.0508, 0.5225, 1.0 },
48 { 0.3509, 0.3710, 0.0178, 1.0 },
49 { 0.0533, 0.0106, 0.8235, 1.0 },
50 { 0.0126, 0.4132, 0.0529, 1.0 },
51 { 0.8709, 0.5754, 0.0042, 1.0 },
52 { 0.4537, 0.0291, 0.7814, 1.0 },
53 { 0.8501, 0.1813, 0.0814, 1.0 },
54 { 0.9954, 0.9418, 0.2448, 1.0 },
55 { 0.0099, 0.5953, 0.3081, 1.0 },
56 { 0.0366, 0.0193, 0.3150, 1.0 }};
58 float hsva
[][4] = {{ 0.0, 0.0, 1.0, 1.0 },
59 { 0.0, 0.0, 0.5, 1.0 },
60 { 0.0, 0.0, 0.0, 1.0 },
61 { 0.0, 1.0, 1.0, 1.0 },
62 { 0.167, 1.0, 0.75, 1.0 },
63 { 0.333, 1.0, 0.5, 1.0 },
64 { 0.5, 0.5, 1.0, 1.0 },
65 { 0.667, 0.5, 1.0, 1.0 },
66 { 0.833, 0.666, 0.75, 1.0 },
67 { 0.172, 0.779, 0.643, 1.0 },
68 { 0.698, 0.887, 0.918, 1.0 },
69 { 0.375, 0.828, 0.675, 1.0 },
70 { 0.137, 0.944, 0.941, 1.0 },
71 { 0.788, 0.792, 0.897, 1.0 },
72 { 0.040, 0.661, 0.931, 1.0 },
73 { 0.158, 0.467, 0.998, 1.0 },
74 { 0.451, 0.875, 0.795, 1.0 },
75 { 0.690, 0.75, 0.597, 1.0 }};
79 CHECK_CONV_FLOAT ("rgba to hsva ", float, 0.001,
80 babl_format ("RGBA float"),
81 babl_format ("HSVA float"),
84 CHECK_CONV_FLOAT ("hsva to rgba ", float, 0.001,
85 babl_format ("HSVA float"),
86 babl_format ("RGBA float"),