Vuo 2.4.4
Loading...
Searching...
No Matches
VuoImageFormat.c
Go to the documentation of this file.
1
10#include "VuoImageFormat.h"
11
13#ifdef VUO_COMPILER
15 "title" : "Image Format",
16 "description" : "Available formats when exporting images from Vuo.",
17 "keywords" : [ ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoList_VuoImageFormat"
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 VuoImageFormat value = VuoImageFormat_PNG;
37
38 if (! strcmp(valueAsString, "PNG")) {
39 value = VuoImageFormat_PNG;
40 } else if (! strcmp(valueAsString, "JPEG")) {
41 value = VuoImageFormat_JPEG;
42 } else if (! strcmp(valueAsString, "TIFF")) {
43 value = VuoImageFormat_TIFF;
44 } else if (! strcmp(valueAsString, "BMP")) {
45 value = VuoImageFormat_BMP;
46 } else if (! strcmp(valueAsString, "HDR")) {
47 value = VuoImageFormat_HDR;
48 } else if (! strcmp(valueAsString, "EXR")) {
49 value = VuoImageFormat_EXR;
50 } else if (! strcmp(valueAsString, "GIF")) {
51 value = VuoImageFormat_GIF;
52 } else if (! strcmp(valueAsString, "TARGA")) {
53 value = VuoImageFormat_TARGA;
54 }
55 else if (! strcmp(valueAsString, "WEBP"))
56 value = VuoImageFormat_WEBP;
57
58 return value;
59}
60
65json_object * VuoImageFormat_getJson(const VuoImageFormat value)
66{
67 char *valueAsString = "";
68
69 switch (value) {
70 case VuoImageFormat_PNG:
71 valueAsString = "PNG";
72 break;
73 case VuoImageFormat_JPEG:
74 valueAsString = "JPEG";
75 break;
76 case VuoImageFormat_TIFF:
77 valueAsString = "TIFF";
78 break;
79 case VuoImageFormat_BMP:
80 valueAsString = "BMP";
81 break;
82 case VuoImageFormat_HDR:
83 valueAsString = "HDR";
84 break;
85 case VuoImageFormat_EXR:
86 valueAsString = "EXR";
87 break;
88 case VuoImageFormat_GIF:
89 valueAsString = "GIF";
90 break;
91 case VuoImageFormat_TARGA:
92 valueAsString = "TARGA";
93 break;
94 case VuoImageFormat_WEBP:
95 valueAsString = "WEBP";
96 break;
97 }
98
99 return json_object_new_string(valueAsString);
100}
101
106{
108 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_PNG);
109 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_JPEG);
110 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_TIFF);
111 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_BMP);
112 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_HDR);
113 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_EXR);
114 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_GIF);
115 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_TARGA);
116 VuoListAppendValue_VuoImageFormat(l, VuoImageFormat_WEBP);
117 return l;
118}
119
125{
126 char *valueAsString = "";
127
128 switch (value) {
129 case VuoImageFormat_PNG:
130 valueAsString = "PNG";
131 break;
132 case VuoImageFormat_JPEG:
133 valueAsString = "JPEG";
134 break;
135 case VuoImageFormat_TIFF:
136 valueAsString = "TIFF";
137 break;
138 case VuoImageFormat_BMP:
139 valueAsString = "BMP";
140 break;
141 case VuoImageFormat_HDR:
142 valueAsString = "HDR";
143 break;
144 case VuoImageFormat_EXR:
145 valueAsString = "EXR";
146 break;
147 case VuoImageFormat_GIF:
148 valueAsString = "GIF";
149 break;
150 case VuoImageFormat_TARGA:
151 valueAsString = "TARGA";
152 break;
153 case VuoImageFormat_WEBP:
154 valueAsString = "WEBP";
155 break;
156 }
157
158 return strdup(valueAsString);
159}
160
166{
167 struct json_object *js = json_object_new_array();
168
169 if (format == VuoImageFormat_PNG)
170 json_object_array_add(js, json_object_new_string("png"));
171 else if (format == VuoImageFormat_JPEG)
172 {
173 json_object_array_add(js, json_object_new_string("jpg"));
174 json_object_array_add(js, json_object_new_string("jpeg"));
175 }
176 else if (format == VuoImageFormat_TIFF)
177 {
178 json_object_array_add(js, json_object_new_string("tif"));
179 json_object_array_add(js, json_object_new_string("tiff"));
180 }
181 else if (format == VuoImageFormat_BMP)
182 json_object_array_add(js, json_object_new_string("bmp"));
183 else if (format == VuoImageFormat_HDR)
184 json_object_array_add(js, json_object_new_string("hdr"));
185 else if (format == VuoImageFormat_EXR)
186 json_object_array_add(js, json_object_new_string("exr"));
187 else if (format == VuoImageFormat_GIF)
188 json_object_array_add(js, json_object_new_string("gif"));
189 else if (format == VuoImageFormat_TARGA)
190 {
191 json_object_array_add(js, json_object_new_string("tga"));
192 json_object_array_add(js, json_object_new_string("targa"));
193 }
194 else if (format == VuoImageFormat_WEBP)
195 json_object_array_add(js, json_object_new_string("webp"));
196
197 return js;
198}
199
205{
206 char *valueAsString = "";
207
208 switch (value) {
209 case VuoImageFormat_PNG:
210 valueAsString = "png";
211 break;
212 case VuoImageFormat_JPEG:
213 valueAsString = "jpeg";
214 break;
215 case VuoImageFormat_TIFF:
216 valueAsString = "tiff";
217 break;
218 case VuoImageFormat_BMP:
219 valueAsString = "bmp";
220 break;
221 case VuoImageFormat_HDR:
222 valueAsString = "hdr";
223 break;
224 case VuoImageFormat_EXR:
225 valueAsString = "exr";
226 break;
227 case VuoImageFormat_GIF:
228 valueAsString = "gif";
229 break;
230 case VuoImageFormat_TARGA:
231 valueAsString = "tga";
232 break;
233 case VuoImageFormat_WEBP:
234 valueAsString = "webp";
235 break;
236 }
237
238 return strdup(valueAsString);
239}
240
245{
246 return value1 == value2;
247}
248
253{
254 return value1 < value2;
255}