Vuo  2.3.2
VuoBlendMode.c
Go to the documentation of this file.
1 
10 #include <stdlib.h>
11 #include <string.h>
12 #include "type.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "Blend Mode",
18  "description" : "Blend Mode Enum.",
19  "keywords" : [ "blend, mix" ],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoBlendMode"
23  ]
24  });
25 #endif
27 
33 {
34  const char *valueAsString = "";
35  if (json_object_get_type(js) == json_type_string)
36  valueAsString = json_object_get_string(js);
37 
39 
40  if( !strcmp(valueAsString, "normal") ) {
41  value = VuoBlendMode_Normal;
42  } else
43  if( !strcmp(valueAsString, "multiply") ) {
44  value = VuoBlendMode_Multiply;
45  } else
46  if( !strcmp(valueAsString, "darker-components") ) {
48  } else
49  if( !strcmp(valueAsString, "darker-component") ) { // deprecated in 1.2.4
51  } else
52  if( !strcmp(valueAsString, "darker-color") ) {
54  } else
55  if( !strcmp(valueAsString, "linear-burn") ) {
57  } else
58  if( !strcmp(valueAsString, "color-burn") ) {
59  value = VuoBlendMode_ColorBurn;
60  } else
61  if( !strcmp(valueAsString, "screen") ) {
62  value = VuoBlendMode_Screen;
63  } else
64  if( !strcmp(valueAsString, "lighter-components") ) {
66  } else
67  if( !strcmp(valueAsString, "lighter-component") ) { // deprecated in 1.2.4
69  } else
70  if( !strcmp(valueAsString, "lighter-color") ) {
72  } else
73  if( !strcmp(valueAsString, "linear-dodge") ) {
75  } else
76  if( !strcmp(valueAsString, "color-dodge") ) {
78  } else
79  if( !strcmp(valueAsString, "overlay") ) {
80  value = VuoBlendMode_Overlay;
81  } else
82  if( !strcmp(valueAsString, "soft-light") ) {
83  value = VuoBlendMode_SoftLight;
84  } else
85  if( !strcmp(valueAsString, "hard-light") ) {
86  value = VuoBlendMode_HardLight;
87  } else
88  if( !strcmp(valueAsString, "vivid-light") ) {
90  } else
91  if( !strcmp(valueAsString, "linear-light") ) {
93  } else
94  if( !strcmp(valueAsString, "pin-light") ) {
95  value = VuoBlendMode_PinLight;
96  } else
97  if( !strcmp(valueAsString, "hard-mix") ) {
98  value = VuoBlendMode_HardMix;
99  } else
100  if( !strcmp(valueAsString, "difference") ) {
101  value = VuoBlendMode_Difference;
102  } else
103  if( !strcmp(valueAsString, "exclusion") ) {
104  value = VuoBlendMode_Exclusion;
105  } else
106  if( !strcmp(valueAsString, "subtract") ) {
107  value = VuoBlendMode_Subtract;
108  } else
109  if( !strcmp(valueAsString, "divide") ) {
110  value = VuoBlendMode_Divide;
111  } else
112  if( !strcmp(valueAsString, "hue") ) {
113  value = VuoBlendMode_Hue;
114  } else
115  if( !strcmp(valueAsString, "saturation") ) {
116  value = VuoBlendMode_Saturation;
117  } else
118  if( !strcmp(valueAsString, "color") ) {
119  value = VuoBlendMode_Color;
120  } else
121  if( !strcmp(valueAsString, "luminosity") ) {
122  value = VuoBlendMode_Luminosity;
123  }
124  else if (strcmp(valueAsString, "power") == 0) return VuoBlendMode_Power;
125 
126  return value;
127 }
128 
134 {
135  char *valueAsString = "";
136 
137  switch (value)
138  {
139  case VuoBlendMode_Normal:
140  valueAsString = "normal";
141  break;
143  valueAsString = "multiply";
144  break;
146  valueAsString = "darker-components";
147  break;
149  valueAsString = "darker-color";
150  break;
152  valueAsString = "linear-burn";
153  break;
155  valueAsString = "color-burn";
156  break;
157  case VuoBlendMode_Screen:
158  valueAsString = "screen";
159  break;
161  valueAsString = "lighter-components";
162  break;
164  valueAsString = "lighter-color";
165  break;
167  valueAsString = "linear-dodge";
168  break;
170  valueAsString = "color-dodge";
171  break;
173  valueAsString = "overlay";
174  break;
176  valueAsString = "soft-light";
177  break;
179  valueAsString = "hard-light";
180  break;
182  valueAsString = "vivid-light";
183  break;
185  valueAsString = "linear-light";
186  break;
188  valueAsString = "pin-light";
189  break;
191  valueAsString = "hard-mix";
192  break;
194  valueAsString = "difference";
195  break;
197  valueAsString = "exclusion";
198  break;
200  valueAsString = "subtract";
201  break;
202  case VuoBlendMode_Divide:
203  valueAsString = "divide";
204  break;
205  case VuoBlendMode_Hue:
206  valueAsString = "hue";
207  break;
209  valueAsString = "saturation";
210  break;
211  case VuoBlendMode_Color:
212  valueAsString = "color";
213  break;
215  valueAsString = "luminosity";
216  break;
217  case VuoBlendMode_Power:
218  valueAsString = "power";
219  break;
220  }
221  return json_object_new_string(valueAsString);
222 }
223 
228 {
232  return l;
233 }
234 
240 {
241  char *valueAsString = "";
242 
243  switch (value)
244  {
245  case VuoBlendMode_Normal:
246  valueAsString = "Normal — Alpha";
247  break;
249  valueAsString = "Multiply — b•f";
250  break;
252  valueAsString = "Darker Components — min(b,f)";
253  break;
255  valueAsString = "Darker Color — min(b,f)";
256  break;
258  valueAsString = "Linear Burn — b+f-1";
259  break;
261  valueAsString = "Color Burn — 1-(1-b)/f";
262  break;
263  case VuoBlendMode_Screen:
264  valueAsString = "Screen — 1-(1-b)•(1-f)";
265  break;
267  valueAsString = "Lighter Components — max(b,f)";
268  break;
270  valueAsString = "Lighter Color — max(b,f)";
271  break;
273  valueAsString = "Linear Dodge (Add) — b+f";
274  break;
276  valueAsString = "Color Dodge — b/(1-f)";
277  break;
279  valueAsString = "Overlay";
280  break;
282  valueAsString = "Soft Light";
283  break;
285  valueAsString = "Hard Light";
286  break;
288  valueAsString = "Vivid Light";
289  break;
291  valueAsString = "Linear Light";
292  break;
294  valueAsString = "Pin Light";
295  break;
297  valueAsString = "Hard Mix";
298  break;
300  valueAsString = "Difference — abs(b-f)";
301  break;
303  valueAsString = "Exclusion — b+f-2•b•f";
304  break;
306  valueAsString = "Subtract — b-f";
307  break;
308  case VuoBlendMode_Divide:
309  valueAsString = "Divide — b/f";
310  break;
311  case VuoBlendMode_Hue:
312  valueAsString = "Hue";
313  break;
315  valueAsString = "Saturation";
316  break;
317  case VuoBlendMode_Color:
318  valueAsString = "Color";
319  break;
321  valueAsString = "Luminosity";
322  break;
323  case VuoBlendMode_Power:
324  valueAsString = "Power — b^f";
325  break;
326  }
327  return strdup(valueAsString);
328 }