summaryrefslogtreecommitdiff
path: root/tests/conversions.c
blob: d699b21cae40c0703b09ece5858c976a0ea5923f (plain)
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
65
66
67
68
69
70
71
72
/* babl - dynamically extendable universal pixel conversion library.
 * Copyright (C) 2005, Øyvind Kolås.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, see
 * <https://www.gnu.org/licenses/>.
 */

#include "config.h"
#include "babl-internal.h"

 static const struct 
  { 
    const char *from_format; 
    const char *to_format; 
  } 
  fishes[] = 
  { 
    { "Y' u8",          "RaGaBaA float" }, 
    { "Y u8",           "RaGaBaA float" }, 
    { "R'G'B'A u8",     "RaGaBaA float" }, 
    { "R'G'B'A float",  "R'G'B'A u8"    }, 
    { "R'G'B'A float",  "R'G'B' u8"     }, 
    { "R'G'B'A u8",     "RGBA float"    }, 
    { "RGBA float",     "R'G'B'A u8"    }, 
    { "RGBA float",     "R'G'B'A u8"    }, 
    { "RGBA float",     "R'G'B'A float" }, 
    { "Y' u8",          "R'G'B' u8"     }, 
    { "Y u8",           "Y float"       }, 
    { "R'G'B' u8",      "cairo-RGB24"   }, 
    { "R'G'B' u8",      "R'G'B'A float" }, 
    { "R'G'B' u8",      "R'G'B'A u8"    }, 
    { "R'G'B'A u8",     "R'G'B'A float" }, 
    { "R'G'B'A u8",     "cairo-ARGB32"  }, 
    { "R'G'B'A double", "RGBA float"    }, 
    { "R'G'B'A float",  "RGBA double"   }, 
    { "R'G'B' u8",      "RGB float"     }, 
    { "RGB float",      "R'G'B'A float" }, 
    { "R'G'B' u8",      "RGBA float"    }, 
    { "RaGaBaA float",  "R'G'B'A float" }, 
    { "RaGaBaA float",  "RGBA float"    }, 
    { "RGBA float",     "RaGaBaA float" }, 
    { "R'G'B' u8",      "RaGaBaA float" }, 
    { "cairo-ARGB32",   "R'G'B'A u8"    } 
  };

int
main (void)
{
  putenv ("BABL_DEBUG_CONVERSIONS" "=" "1");
  putenv ("BABL_DEBUG_MISSING" "=" "1");
  babl_init ();
  
  for (size_t i = 0; i < sizeof (fishes)/sizeof(fishes[0]);i ++)
  {
    babl_fish (babl_format (fishes[i].from_format),
               babl_format (fishes[i].to_format));
  }

  babl_exit ();
  return 0;
}