Vuo  2.0.0
VuoSizingMode.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoSizingMode.h"
12 #include "VuoList_VuoSizingMode.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "Sizing Mode",
18  "description" : "Controls how an image is resized in the event that the dimensions are not evenly scaled.",
19  "keywords" : [ "resize", "scale", "fit", "fill", "stretch" ],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoSizingMode"
23  ]
24  });
25 #endif
26 
33 {
34  const char *valueAsString = "";
35  if (json_object_get_type(js) == json_type_string)
36  valueAsString = json_object_get_string(js);
37 
38  if (strcmp(valueAsString, "fit") == 0)
39  return VuoSizingMode_Fit;
40  else if (strcmp(valueAsString, "fill") == 0)
41  return VuoSizingMode_Fill;
42  else if (strcmp(valueAsString, "proportional") == 0)
43  return VuoSizingMode_Proportional;
44  else
45  return VuoSizingMode_Stretch;
46 }
47 
53 {
54  if (value == VuoSizingMode_Fit)
55  return json_object_new_string("fit");
56  else if (value == VuoSizingMode_Fill)
57  return json_object_new_string("fill");
58  else if (value == VuoSizingMode_Proportional)
59  return json_object_new_string("proportional");
60  else
61  return json_object_new_string("stretch");
62 }
63 
68 {
70  VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Stretch);
71  VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Fit);
72  VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Fill);
73  VuoListAppendValue_VuoSizingMode(l, VuoSizingMode_Proportional);
74  return l;
75 }
76 
82 {
83  if (value == VuoSizingMode_Fit)
84  return strdup("Fit");
85  else if (value == VuoSizingMode_Fill)
86  return strdup("Fill");
87  else if (value == VuoSizingMode_Proportional)
88  return strdup("Proportional");
89  else
90  return strdup("Stretch");
91 }