Vuo 2.4.4
Loading...
Searching...
No Matches
VuoSizingMode.c
Go to the documentation of this file.
1
10#include "VuoSizingMode.h"
11
13#ifdef VUO_COMPILER
15 "title" : "Sizing Mode",
16 "description" : "Controls how an image is resized in the event that the dimensions are not evenly scaled.",
17 "keywords" : [ "resize", "scale", "fit", "fill", "stretch" ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoList_VuoSizingMode"
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 if (strcmp(valueAsString, "fit") == 0)
37 return VuoSizingMode_Fit;
38 else if (strcmp(valueAsString, "fill") == 0)
39 return VuoSizingMode_Fill;
40 else if (strcmp(valueAsString, "proportional") == 0)
41 return VuoSizingMode_Proportional;
42 else
43 return VuoSizingMode_Stretch;
44}
45
50json_object * VuoSizingMode_getJson(const VuoSizingMode value)
51{
52 if (value == VuoSizingMode_Fit)
53 return json_object_new_string("fit");
54 else if (value == VuoSizingMode_Fill)
55 return json_object_new_string("fill");
56 else if (value == VuoSizingMode_Proportional)
57 return json_object_new_string("proportional");
58 else
59 return json_object_new_string("stretch");
60}
61
66{
68 VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Stretch);
69 VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Fit);
70 VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Fill);
71 VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Proportional);
72 return l;
73}
74
80{
81 if (value == VuoSizingMode_Fit)
82 return strdup("Fit");
83 else if (value == VuoSizingMode_Fill)
84 return strdup("Fill");
85 else if (value == VuoSizingMode_Proportional)
86 return strdup("Proportional");
87 else
88 return strdup("Stretch");
89}