1 /* This file is part of GEGL
2  *
3  * GEGL 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  * GEGL 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 Public
14  * License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
15  */
16 
17 #include "config.h"
18 
19 #include <glib-object.h>
20 #include <glib/gi18n-lib.h>
21 
22 #include "gegl-enums.h"
23 
24 
25 GType
gegl_dither_method_get_type(void)26 gegl_dither_method_get_type (void)
27 {
28   static GType etype = 0;
29 
30   if (etype == 0)
31     {
32       static GEnumValue values[] = {
33         { GEGL_DITHER_NONE,             N_("None"),             "none"             },
34         { GEGL_DITHER_FLOYD_STEINBERG,  N_("Floyd-Steinberg"),  "floyd-steinberg"  },
35         { GEGL_DITHER_BAYER,            N_("Bayer"),            "bayer"            },
36         { GEGL_DITHER_RANDOM,           N_("Random"),           "random"           },
37         { GEGL_DITHER_RANDOM_COVARIANT, N_("Random Covariant"), "random-covariant" },
38         { GEGL_DITHER_ARITHMETIC_ADD,   N_("Arithmetic add"),   "add"  },
39         { GEGL_DITHER_ARITHMETIC_ADD_COVARIANT,   N_("Arithmetic add covariant"),  "add-covariant"  },
40         { GEGL_DITHER_ARITHMETIC_XOR,   N_("Arithmetic xor"),   "xor"  },
41         { GEGL_DITHER_ARITHMETIC_XOR_COVARIANT,   N_("Arithmetic xor covariant"),  "xor-covariant"  },
42         { GEGL_DITHER_BLUE_NOISE,   N_("Blue Noise"),  "blue-noise"  },
43         { GEGL_DITHER_BLUE_NOISE_COVARIANT,   N_("Blue Noise Covariant"),  "blue-noise-covariant"  },
44 
45         { 0, NULL, NULL }
46       };
47       gint i;
48 
49       for (i = 0; i < G_N_ELEMENTS (values); i++)
50         if (values[i].value_name)
51           values[i].value_name =
52             dgettext (GETTEXT_PACKAGE, values[i].value_name);
53 
54       etype = g_enum_register_static ("GeglDitherMethod", values);
55     }
56 
57   return etype;
58 }
59 
60 GType
gegl_distance_metric_get_type(void)61 gegl_distance_metric_get_type (void)
62 {
63   static GType etype = 0;
64 
65   if (etype == 0)
66     {
67       static GEnumValue values[] = {
68         { GEGL_DISTANCE_METRIC_EUCLIDEAN, N_("Euclidean"), "euclidean"  },
69         { GEGL_DISTANCE_METRIC_MANHATTAN, N_("Manhattan"), "manhattan"  },
70         { GEGL_DISTANCE_METRIC_CHEBYSHEV, N_("Chebyshev"), "chebyshev" },
71 
72         { 0, NULL, NULL }
73       };
74       gint i;
75 
76       for (i = 0; i < G_N_ELEMENTS (values); i++)
77         if (values[i].value_name)
78           values[i].value_name =
79             dgettext (GETTEXT_PACKAGE, values[i].value_name);
80 
81       etype = g_enum_register_static ("GeglDistanceMetric", values);
82     }
83 
84   return etype;
85 }
86 
87 GType
gegl_orientation_get_type(void)88 gegl_orientation_get_type (void)
89 {
90   static GType etype = 0;
91 
92   if (etype == 0)
93     {
94       static GEnumValue values[] = {
95         { GEGL_ORIENTATION_HORIZONTAL, N_("Horizontal"), "horizontal" },
96         { GEGL_ORIENTATION_VERTICAL,   N_("Vertical"),   "vertical"   },
97         { 0, NULL, NULL }
98       };
99       gint i;
100 
101       for (i = 0; i < G_N_ELEMENTS (values); i++)
102         if (values[i].value_name)
103           values[i].value_name =
104             dgettext (GETTEXT_PACKAGE, values[i].value_name);
105 
106       etype = g_enum_register_static ("GeglOrientation", values);
107     }
108 
109   return etype;
110 }
111 
112 GType
gegl_babl_variant_get_type(void)113 gegl_babl_variant_get_type (void)
114 {
115   static GType etype = 0;
116 
117   if (etype == 0)
118     {
119       static GEnumValue values[] = {
120         { GEGL_BABL_VARIANT_FLOAT, N_("Float"), "float"},
121         { GEGL_BABL_VARIANT_LINEAR, N_("Linear"), "linear"},
122         { GEGL_BABL_VARIANT_NONLINEAR, N_("Non-linear"), "non-linear"},
123         { GEGL_BABL_VARIANT_PERCEPTUAL, N_("Perceptual"), "perceptual"},
124         { GEGL_BABL_VARIANT_LINEAR_PREMULTIPLIED, N_("Linear-premultiplied"), "linear-premultiplied"},
125         { GEGL_BABL_VARIANT_PERCEPTUAL_PREMULTIPLIED, N_("Perceptual-premultiplied"), "perceptual-premultiplied"},
126         { GEGL_BABL_VARIANT_LINEAR_PREMULTIPLIED_IF_ALPHA, N_("Linear-premultiplied-if-alpha"), "linear-premultiplied-if-alpha"},
127         { GEGL_BABL_VARIANT_PERCEPTUAL_PREMULTIPLIED_IF_ALPHA, N_("Perceptual-premultiplied-if-alpha"), "perceptual-premultiplied-if-alpha"},
128         { GEGL_BABL_VARIANT_ALPHA, N_("add-alpha"), "add-alpha"},
129         { 0, NULL, NULL }
130       };
131       gint i;
132 
133       for (i = 0; i < G_N_ELEMENTS (values); i++)
134         if (values[i].value_name)
135           values[i].value_name =
136             dgettext (GETTEXT_PACKAGE, values[i].value_name);
137 
138       etype = g_enum_register_static ("GeglBablVariant", values);
139     }
140 
141   return etype;
142 }
143 
144 GType
gegl_cache_policy_get_type(void)145 gegl_cache_policy_get_type (void)
146 {
147   static GType etype = 0;
148 
149   if (etype == 0)
150     {
151       static GEnumValue values[] = {
152         { GEGL_CACHE_POLICY_AUTO, N_("Auto"), "auto" },
153         { GEGL_CACHE_POLICY_NEVER, N_("Never"), "never" },
154         { GEGL_CACHE_POLICY_ALWAYS, N_("Always"), "always" },
155         { 0, NULL, NULL }
156       };
157       gint i;
158 
159       for (i = 0; i < G_N_ELEMENTS (values); i++)
160         if (values[i].value_name)
161           values[i].value_name =
162             dgettext (GETTEXT_PACKAGE, values[i].value_name);
163 
164       etype = g_enum_register_static ("GeglCachePolicy", values);
165     }
166 
167   return etype;
168 }
169