16 "title" :
"2D Transform",
17 "description" :
"A 2D transformation (scale, rotation, translation).",
45 t.translation = translation;
69 if (json_object_object_get_ex(js,
"rotation", &o))
70 t.
rotation = json_object_get_double(o);
72 if (json_object_object_get_ex(js,
"translation", &o))
74 t.translation.x = json_object_get_double(json_object_array_get_idx(o,0));
75 t.translation.y = json_object_get_double(json_object_array_get_idx(o,1));
78 if (json_object_object_get_ex(js,
"scale", &o))
80 t.scale.x = json_object_get_double(json_object_array_get_idx(o,0));
81 t.scale.y = json_object_get_double(json_object_array_get_idx(o,1));
94 return json_object_new_string(
"identity");
100 json_object_array_add(o,json_object_new_double(value.translation.x));
101 json_object_array_add(o,json_object_new_double(value.translation.y));
102 json_object_object_add(js,
"translation", o);
105 json_object_object_add(js,
"rotation", json_object_new_double(value.
rotation));
109 json_object_array_add(o,json_object_new_double(value.scale.x));
110 json_object_array_add(o,json_object_new_double(value.scale.y));
111 json_object_object_add(js,
"scale", o);
125 return strdup(
"identity transform (no change)");
128 return VuoText_format(
"<div>translation (%g, %g)</div><div>rotation %g°</div><div>scale (%g, %g)</div>",
129 value.translation.x, value.translation.y, rotationInDegrees, value.scale.x, value.scale.y);