You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
509B

  1. #include "app.hpp"
  2. #include "color.hpp"
  3. namespace rack {
  4. void MultiLightWidget::addBaseColor(NVGcolor baseColor) {
  5. baseColors.push_back(baseColor);
  6. }
  7. void MultiLightWidget::setValues(const std::vector<float> &values) {
  8. assert(values.size() == baseColors.size());
  9. color = nvgRGBAf(0, 0, 0, 0);
  10. for (size_t i = 0; i < baseColors.size(); i++) {
  11. NVGcolor c = baseColors[i];
  12. c.a *= clamp(values[i], 0.f, 1.f);
  13. color = color::screen(color, c);
  14. }
  15. color = color::clip(color);
  16. }
  17. } // namespace rack