Vuo 2.4.4
Loading...
Searching...
No Matches
VuoThresholdType.c
Go to the documentation of this file.
1
10#include "VuoThresholdType.h"
11
13#ifdef VUO_COMPILER
15 "title" : "Brightness Type",
16 "description" : "How to determine the brightness of a color",
17 "keywords" : [ "mask", "color" ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoList_VuoThresholdType"
21 ]
22 });
23#endif
25
31{
32 const char *valueAsString = "";
33 if (json_object_get_type(js) == json_type_string)
34 valueAsString = json_object_get_string(js);
35
36 VuoThresholdType value = VuoThresholdType_Rec601;
37
38 if (!strcmp(valueAsString, "rec709"))
39 value = VuoThresholdType_Rec709;
40 else if (!strcmp(valueAsString, "desaturate"))
41 value = VuoThresholdType_Desaturate;
42 else if (!strcmp(valueAsString, "rgb"))
43 value = VuoThresholdType_RGB;
44 else if (!strcmp(valueAsString, "rgb-average"))
45 value = VuoThresholdType_RGBAverage;
46 else if (!strcmp(valueAsString, "rgb-maximum"))
47 value = VuoThresholdType_RGBMaximum;
48 else if (!strcmp(valueAsString, "rgb-minimum"))
49 value = VuoThresholdType_RGBMinimum;
50 else if( !strcmp(valueAsString, "red"))
51 value = VuoThresholdType_Red;
52 else if( !strcmp(valueAsString, "green"))
53 value = VuoThresholdType_Green;
54 else if (!strcmp(valueAsString, "blue"))
55 value = VuoThresholdType_Blue;
56 else if(!strcmp(valueAsString, "alpha"))
57 value = VuoThresholdType_Alpha;
58
59 return value;
60}
61
67{
68 char *valueAsString;
69
70 switch (value)
71 {
72 case VuoThresholdType_Rec709:
73 valueAsString = "rec709";
74 break;
75
76 case VuoThresholdType_Desaturate:
77 valueAsString = "desaturate";
78 break;
79
80 case VuoThresholdType_RGB:
81 valueAsString = "rgb";
82 break;
83
84 case VuoThresholdType_RGBAverage:
85 valueAsString = "rgb-average";
86 break;
87
88 case VuoThresholdType_RGBMaximum:
89 valueAsString = "rgb-maximum";
90 break;
91
92 case VuoThresholdType_RGBMinimum:
93 valueAsString = "rgb-minimum";
94 break;
95
96 case VuoThresholdType_Red:
97 valueAsString = "red";
98 break;
99
100 case VuoThresholdType_Green:
101 valueAsString = "green";
102 break;
103
104 case VuoThresholdType_Blue:
105 valueAsString = "blue";
106 break;
107
108 case VuoThresholdType_Alpha:
109 valueAsString = "alpha";
110 break;
111
112 default:
113 valueAsString = "rec601";
114 }
115 return json_object_new_string(valueAsString);
116}
117
122{
124 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_Rec601);
125 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_Rec709);
126 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_Desaturate);
127 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_RGB);
128 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_RGBAverage);
129 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_RGBMaximum);
130 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_RGBMinimum);
131 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_Red);
132 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_Green);
133 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_Blue);
134 VuoListAppendValue_VuoThresholdType(l, VuoThresholdType_Alpha);
135 return l;
136}
142{
143 char *valueAsString = "";
144
145 switch (value)
146 {
147 case VuoThresholdType_Rec601:
148 valueAsString = "Perceptual (ITU Rec. 601 / NTSC CRT)";
149 break;
150
151 case VuoThresholdType_Rec709:
152 valueAsString = "Perceptual (ITU Rec. 709 / HDTV)";
153 break;
154
155 case VuoThresholdType_Desaturate:
156 valueAsString = "Desaturate (HSL)";
157 break;
158
159 case VuoThresholdType_RGB:
160 valueAsString = "Individual Components (RGB)";
161 break;
162
163 case VuoThresholdType_RGBAverage:
164 valueAsString = "Average Components (RGB)";
165 break;
166
167 case VuoThresholdType_RGBMaximum:
168 valueAsString = "Lightest Components (RGB)";
169 break;
170
171 case VuoThresholdType_RGBMinimum:
172 valueAsString = "Darkest Components (RGB)";
173 break;
174
175 case VuoThresholdType_Red:
176 valueAsString = "Red";
177 break;
178
179 case VuoThresholdType_Green:
180 valueAsString = "Green";
181 break;
182
183 case VuoThresholdType_Blue:
184 valueAsString = "Blue";
185 break;
186
187 case VuoThresholdType_Alpha:
188 valueAsString = "Opacity";
189 break;
190 }
191
192 return strdup(valueAsString);
193}