Vuo  2.0.2
VuoImageWrapMode.c
Go to the documentation of this file.
1 
10 #include <string.h>
11 #include "type.h"
12 
14 #ifdef VUO_COMPILER
16  "title" : "Image Wrap Mode",
17  "description" : "Controls what an image displays when the pixels requested are out of range.",
18  "keywords" : [ "overlap", "repeat", "clamp", "tile" ],
19  "version" : "1.0.0",
20  "dependencies" : [
21  "VuoList_VuoImageWrapMode"
22  ]
23  });
24 #endif
25 
32 {
33  const char *valueAsString = "";
34  if (json_object_get_type(js) == json_type_string)
35  valueAsString = json_object_get_string(js);
36 
37  VuoImageWrapMode value = VuoImageWrapMode_None;
38 
39  if (! strcmp(valueAsString, "none")) {
40  value = VuoImageWrapMode_None;
41  } else if (! strcmp(valueAsString, "clamp")) {
42  value = VuoImageWrapMode_ClampEdge;
43  } else if (! strcmp(valueAsString, "repeat")) {
44  value = VuoImageWrapMode_Repeat;
45  } else if (! strcmp(valueAsString, "mirror")) {
46  value = VuoImageWrapMode_MirroredRepeat;
47  }
48 
49  return value;
50 }
51 
57 {
58  char *valueAsString = "";
59 
60  switch (value) {
61  case VuoImageWrapMode_None:
62  valueAsString = "none";
63  break;
64  case VuoImageWrapMode_ClampEdge:
65  valueAsString = "clamp";
66  break;
67  case VuoImageWrapMode_Repeat:
68  valueAsString = "repeat";
69  break;
70  case VuoImageWrapMode_MirroredRepeat:
71  valueAsString = "mirror";
72  break;
73  }
74 
75  return json_object_new_string(valueAsString);
76 }
77 
82 {
84  VuoListAppendValue_VuoImageWrapMode(l, VuoImageWrapMode_None);
85  VuoListAppendValue_VuoImageWrapMode(l, VuoImageWrapMode_ClampEdge);
86  VuoListAppendValue_VuoImageWrapMode(l, VuoImageWrapMode_Repeat);
87  VuoListAppendValue_VuoImageWrapMode(l, VuoImageWrapMode_MirroredRepeat);
88  return l;
89 }
90 
96 {
97  char *valueAsString = "";
98 
99  switch (value)
100  {
101  case VuoImageWrapMode_None:
102  valueAsString = "None";
103  break;
104 
105  case VuoImageWrapMode_ClampEdge:
106  valueAsString = "Clamp Edge";
107  break;
108 
109  case VuoImageWrapMode_Repeat:
110  valueAsString = "Repeat";
111  break;
112 
113  case VuoImageWrapMode_MirroredRepeat:
114  valueAsString = "Mirror Repeat";
115  break;
116  }
117  return strdup(valueAsString);
118 }