Vuo  2.4.0
VuoProjectionType.c
Go to the documentation of this file.
1
10#include "type.h"
11#include "VuoProjectionType.h"
13
15#ifdef VUO_COMPILER
17 "title" : "Projection Type",
18 "description" : "Describes how an image is transformed when rendering with a perspective.",
19 "keywords" : [ "scale", "distance", "project", "map", "mapping" ],
20 "version" : "1.0.0",
21 "dependencies" : [
22 "VuoList_VuoProjectionType"
23 ]
24 });
25#endif
27
33{
34 const char *valueAsString = "";
35
36 if (json_object_get_type(js) == json_type_string)
37 valueAsString = json_object_get_string(js);
38
39 VuoProjectionType value = VuoProjectionType_Perspective;
40
41 if (! strcmp(valueAsString, "perspective"))
42 value = VuoProjectionType_Perspective;
43 else if (! strcmp(valueAsString, "affine"))
44 value = VuoProjectionType_Affine;
45
46 return value;
47}
48
54{
55 char *valueAsString = "";
56
57 switch (value)
58 {
59 case VuoProjectionType_Perspective:
60 valueAsString = "perspective";
61 break;
62 case VuoProjectionType_Affine:
63 valueAsString = "affine";
64 break;
65 }
66
67 return json_object_new_string(valueAsString);
68}
69
74{
76 VuoListAppendValue_VuoProjectionType(l, VuoProjectionType_Perspective);
77 VuoListAppendValue_VuoProjectionType(l, VuoProjectionType_Affine);
78 return l;
79}
80
86{
87 char *valueAsString = "";
88
89 switch (value)
90 {
91 case VuoProjectionType_Perspective:
92 valueAsString = "Perspective";
93 break;
94 case VuoProjectionType_Affine:
95 valueAsString = "Affine";
96 break;
97 }
98
99 return strdup(valueAsString);
100}