Vuo  2.1.2
VuoInputEditorCurveRenderer.cc
Go to the documentation of this file.
1 
11 
15 QIcon *renderMenuIconWithCurve(VuoCurve curve, VuoCurveEasing easing, bool isDark)
16 {
17  return VuoInputEditorIcon::renderIcon(^(QPainter &p){
18  QPainterPath path;
19  path.moveTo(0,15.5);
20  for (VuoReal x = 0; x <= 14; ++x)
21  path.lineTo(0.5+x, 15.5-VuoReal_curve(x, 0, 14, 14, curve, easing, VuoLoopType_None));
22  p.strokePath(path, QPen(isDark ? Qt::white : Qt::black, 1.));
23  });
24 }
25 
29 QIcon *renderMenuIconWithWave(VuoWave wave, bool isDark)
30 {
31  return VuoInputEditorIcon::renderIcon(^(QPainter &p){
32  QPainterPath path;
33  path.moveTo(0,15.5);
34 
35  if (wave == VuoWave_Sine)
36  for (VuoReal x = 0; x <= 14; ++x)
37  path.lineTo(0.5+x, 7.5+7.*cos(2.*M_PI*x/14.));
38  else if (wave == VuoWave_Triangle)
39  path.lineTo(7.5, 1.0);
40  else if (wave == VuoWave_Sawtooth)
41  path.lineTo(14.5, 1.0);
42 
43  path.lineTo(14.5, 15.0);
44  p.strokePath(path, QPen(isDark ? Qt::white : Qt::black, 1.));
45  });
46 }
47 
51 QIcon *renderMenuIconWithWrapMode(VuoWrapMode wrapMode, bool isDark)
52 {
53  return VuoInputEditorIcon::renderIcon(^(QPainter &p){
54  QPainterPath path;
55  path.moveTo(1.0, 10.5);
56  if (wrapMode == VuoWrapMode_Wrap)
57  {
58  path.lineTo(5.0, 5.5);
59  path.moveTo(6.0, 10.5);
60  path.lineTo(10.0, 5.5);
61  path.moveTo(11.0, 10.5);
62  path.lineTo(15.0, 5.5);
63  }
64  else if (wrapMode == VuoWrapMode_Saturate)
65  {
66  path.lineTo(6, 10.5);
67  path.lineTo(11, 5.5);
68  path.lineTo(15.5, 5.5);
69  }
70  p.strokePath(path, QPen(isDark ? Qt::white : Qt::black, 1.));
71  });
72 }
73 
77 QIcon *renderMenuIconWithLoopType(VuoLoopType loopType, bool isDark)
78 {
79  return VuoInputEditorIcon::renderIcon(^(QPainter &p){
80  QPainterPath path;
81  path.moveTo(1.0, 10.5);
82  if (loopType == VuoLoopType_Loop)
83  {
84  path.lineTo(5.0, 5.5);
85  path.moveTo(6.0, 10.5);
86  path.lineTo(10.0, 5.5);
87  path.moveTo(11.0, 10.5);
88  path.lineTo(15.0, 5.5);
89  }
90  else if (loopType == VuoLoopType_Mirror)
91  {
92  path.lineTo(5.0, 5.5);
93  path.lineTo(6.0, 5.5);
94  path.lineTo(10.0, 10.5);
95  path.lineTo(11.0, 10.5);
96  path.lineTo(15.0, 5.5);
97  }
98  else if (loopType == VuoLoopType_None)
99  path.lineTo(5.0, 5.5);
100  p.strokePath(path, QPen(isDark ? Qt::white : Qt::black, 1.));
101  });
102 }
103 
107 QIcon *renderMenuIconWithSizingMode(VuoSizingMode sizingMode, bool isDark)
108 {
109  return VuoInputEditorIcon::renderIcon(^(QPainter &p){
110  QPainterPath grayPath, blackPath;
111  if (sizingMode == VuoSizingMode_Stretch)
112  blackPath.addRect(QRectF(1.0, 5.0, 13.0, 5.0));
113  else if (sizingMode == VuoSizingMode_Fit)
114  {
115  grayPath.addRect(QRectF(0.5, 4.5, 14.0, 6.0));
116  blackPath.addRect(QRectF(5.0, 5.0, 5.0, 5.0));
117  }
118  else if (sizingMode == VuoSizingMode_Fill)
119  {
120  grayPath.addRect(QRectF(0.5, 4.5, 14.0, 6.0));
121  blackPath.addRect(QRectF(1.0, 1.0, 13.0, 13.0));
122  }
123  else if (sizingMode == VuoSizingMode_Proportional)
124  blackPath.addRect(QRectF(5.0, 5.0, 5.0, 5.0));
125  p.strokePath(grayPath, QPen(QColor(isDark ? "#606060" : "#808080"), 1.));
126  p.strokePath(blackPath, QPen(QColor(isDark ? "#ffffff" : "#000000"), 1.));
127  });
128 }