18 "title":
"UI Theme: Button, Rounded",
29 "VuoHorizontalAlignment",
30 "VuoVerticalAlignment",
47 VuoPoint2d labelPadding;
70 VuoJson_getObjectValue(
VuoFont, js,
"labelFont", (
VuoFont){
VuoText_make(
"Avenir-Medium"), 24,
false, (
VuoColor){1,1,1,1}, VuoHorizontalAlignment_Center, 1, 1}),
93 VuoPoint2d _labelPadding,
106 minimumWidth = _minimumWidth;
107 minimumHeight = _minimumHeight;
108 labelFont = _labelFont;
110 labelPosition = _labelPosition;
111 labelPadding = _labelPadding;
112 labelColor = _labelColor;
113 labelColorHovered = _labelColorHovered;
114 labelColorPressed = _labelColorPressed;
115 backgroundColor = _backgroundColor;
116 backgroundColorHovered = _backgroundColorHovered;
117 backgroundColorPressed = _backgroundColorPressed;
118 borderColor = _borderColor;
119 borderColorHovered = _borderColorHovered;
120 borderColorPressed = _borderColorPressed;
121 borderThickness = _borderThickness;
122 cornerRoundness = _cornerRoundness;
135 json_object_object_add(json,
"minimumWidth",
VuoReal_getJson(minimumWidth));
136 json_object_object_add(json,
"minimumHeight",
VuoReal_getJson(minimumHeight));
141 json_object_object_add(json,
"labelColorHovered",
VuoColor_getJson(labelColorHovered));
142 json_object_object_add(json,
"labelColorPressed",
VuoColor_getJson(labelColorPressed));
143 json_object_object_add(json,
"backgroundColor",
VuoColor_getJson(backgroundColor));
144 json_object_object_add(json,
"backgroundColorHovered",
VuoColor_getJson(backgroundColorHovered));
145 json_object_object_add(json,
"backgroundColorPressed",
VuoColor_getJson(backgroundColorPressed));
147 json_object_object_add(json,
"borderColorHovered",
VuoColor_getJson(borderColorHovered));
148 json_object_object_add(json,
"borderColorPressed",
VuoColor_getJson(borderColorPressed));
149 json_object_object_add(json,
"borderThickness",
VuoReal_getJson(borderThickness));
150 json_object_object_add(json,
"cornerRoundness",
VuoReal_getJson(cornerRoundness));
159 return strdup(
"Action Button Theme (Rounded)");
177 &&
VuoColor_areEqual(backgroundColorHovered, thatSpecialized->backgroundColorHovered)
178 &&
VuoColor_areEqual(backgroundColorPressed, thatSpecialized->backgroundColorPressed)
223 float actualWidth = minimumWidth;
224 float actualHeight = minimumHeight;
228 f.color = (
VuoColor){f.color.r * labelColorPressed.r,
229 f.color.g * labelColorPressed.g,
230 f.color.b * labelColorPressed.b,
231 f.color.a * labelColorPressed.a};
233 f.color = (
VuoColor){f.color.r * labelColorHovered.r,
234 f.color.g * labelColorHovered.g,
235 f.color.b * labelColorHovered.b,
236 f.color.a * labelColorHovered.a};
238 f.color = (
VuoColor){f.color.r * labelColor.r,
239 f.color.g * labelColor.g,
240 f.color.b * labelColor.b,
241 f.color.a * labelColor.a};
243 VuoPoint2d textSize = (VuoPoint2d){0,0};
248 actualWidth = fmax(actualWidth, textSize.x);
249 actualHeight = fmax(actualHeight, textSize.y);
254 actualWidth = fmax(actualWidth, textSize.x + labelPadding.x * 2);
255 actualHeight = fmax(actualHeight, textSize.y + labelPadding.y * 2);
257 actualWidth += borderThickness * 2;
258 actualHeight += borderThickness * 2;
267 float innerCornerRoundness = (actualHeight - borderThickness * 2 - (actualHeight * (1-cornerRoundness))) / (actualHeight - borderThickness * 2);
270 isPressed ? backgroundColorPressed : (isHovered ? backgroundColorHovered : backgroundColor),
273 actualWidth - borderThickness * 2,
274 actualHeight - borderThickness * 2,
276 innerCornerRoundness);
279 isPressed ? borderColorPressed : (isHovered ? borderColorHovered : borderColor),
290 offset.x = actualWidth * .5f;
292 offset.x = -actualWidth * .5f;
295 offset.y = -actualHeight * .5f;
297 offset.y = actualHeight * .5f;
308 (
VuoAnchor_getHorizontal(labelPosition) == VuoHorizontalAlignment_Left ? (-(actualWidth-labelPadding.x)) : (actualWidth-labelPadding.x)) * .5f,
313 (
VuoAnchor_getVertical(labelPosition) == VuoVerticalAlignment_Top ? (actualHeight-labelPadding.y) : (-(actualHeight-labelPadding.y))) * .5f,
337 VuoPoint2d labelPadding,
359 backgroundColorHovered,
360 backgroundColorPressed,