98 int delay = elem->delay;
100 if (elem->grad ==
PULSE)
103 const int numOfColors = (elem->grad ==
SPECTRUM ? 6 :
104 elem->grad ==
PULSE ? 127 :
107 elem->gradientIndex = (elem->gradientIndex + advance) %
108 (delay * numOfColors);
110 const int pos = elem->gradientIndex % delay;
111 const int colIndex = elem->gradientIndex / delay;
113 switch (elem->grad) {
117 const int colVal = (int) (255.0 * sin(
PI * colIndex / numOfColors));
118 const gcn::Color &col = elem->testColor;
120 elem->color.r = ((colVal * col.r) / 255) % (col.r + 1);
121 elem->color.g = ((colVal * col.g) / 255) % (col.g + 1);
122 elem->color.b = ((colVal * col.b) / 255) % (col.b + 1);
130 colVal = (int)(255.0 * (cos(
PI * pos / delay) + 1) / 2);
134 colVal = (int)(255.0 * (cos(
PI * (delay - pos) / delay) +
139 (colIndex == 0 || colIndex == 5) ? 255 :
140 (colIndex == 1 || colIndex == 4) ? colVal : 0;
142 (colIndex == 1 || colIndex == 2) ? 255 :
143 (colIndex == 0 || colIndex == 3) ? colVal : 0;
145 (colIndex == 3 || colIndex == 4) ? 255 :
146 (colIndex == 2 || colIndex == 5) ? colVal : 0;
151 const gcn::Color &destCol =
154 const double startColVal = (cos(
PI * pos / delay) + 1) / 2;
155 const double destColVal = 1 - startColVal;
157 elem->color.r =(int)(startColVal * startCol.r +
158 destColVal * destCol.r);
160 elem->color.g =(int)(startColVal * startCol.g +
161 destColVal * destCol.g);
163 elem->color.b =(int)(startColVal * startCol.b +
164 destColVal * destCol.b);
void setColor(int type, const gcn::Color &color, const std::optional< gcn::Color > &outlineColor, GradientType grad, int delay)