Vuo  2.4.0
VuoInputEditorDisplacement.cc
Go to the documentation of this file.
1
11
12extern "C"
13{
14 #include "VuoDisplacement.h"
15}
16
18
23{
24 return new VuoInputEditorDisplacement();
25}
26
30static QIcon *renderMenuIconWithDisplacement(VuoDisplacement displacement, bool isDark)
31{
32 return VuoInputEditorIcon::renderIcon(^(QPainter &p){
33 if (displacement == VuoDisplacement_Transverse)
34 {
35 QPainterPath path;
36 for (VuoReal x = 0; x <= 15; ++x)
37 {
38 VuoReal y = 8-3.5*sin(2.*M_PI*x/7.4);
39 if (x == 0)
40 path.moveTo(0.5+x, y);
41 else
42 path.lineTo(0.5+x, y);
43 }
44 p.strokePath(path, QPen(QColor(isDark ? "#ffffff" : "#000000"), 1.));
45 }
46 else if (displacement == VuoDisplacement_Longitudinal)
47 {
48 int c = isDark ? 255 : 0;
49 for (VuoReal x = 0; x <= 15; ++x)
50 {
51 p.setPen(QPen(QColor(c,c,c,sin(2.*M_PI*x/7.4)*112+128), 1.));
52 p.drawLine(QPointF(0.5+x, 7.5-3), QPointF(0.5+x, 7.5+4));
53 }
54 }
55 });
56}
57
62{
63 VuoInputEditorMenuItem *optionsTree = new VuoInputEditorMenuItem("root");
64
65 for (int i = 0; i <= VuoDisplacement_Longitudinal; ++i)
66 {
68 char *optionSummary = VuoDisplacement_getSummary( (VuoDisplacement)i );
70 free(optionSummary);
71 optionsTree->addItem(optionItem);
72 }
73
74 return optionsTree;
75}