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.

38 lines
787B

  1. #include "app.hpp"
  2. namespace rack {
  3. void Panel::draw(NVGcontext *vg) {
  4. nvgBeginPath(vg);
  5. nvgRect(vg, 0.0, 0.0, box.size.x, box.size.y);
  6. // Background color
  7. if (backgroundColor.a > 0) {
  8. nvgFillColor(vg, backgroundColor);
  9. nvgFill(vg);
  10. }
  11. // Background image
  12. if (backgroundImage) {
  13. int width, height;
  14. nvgImageSize(vg, backgroundImage->handle, &width, &height);
  15. NVGpaint paint = nvgImagePattern(vg, 0.0, 0.0, width, height, 0.0, backgroundImage->handle, 1.0);
  16. nvgFillPaint(vg, paint);
  17. nvgFill(vg);
  18. }
  19. // Border
  20. NVGcolor borderColor = nvgRGBAf(0.5, 0.5, 0.5, 0.5);
  21. nvgBeginPath(vg);
  22. nvgRect(vg, 0.5, 0.5, box.size.x - 1.0, box.size.y - 1.0);
  23. nvgStrokeColor(vg, borderColor);
  24. nvgStrokeWidth(vg, 1.0);
  25. nvgStroke(vg);
  26. Widget::draw(vg);
  27. }
  28. } // namespace rack