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.

19 lines
1.0KB

  1. #include "ReFineLookAndFeel.h"
  2. void RefineLookAndFeel::drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPosProportional, float /*rotaryStartAngle*/, float /*rotaryEndAngle*/, Slider& slider)
  3. {
  4. if (RefinedSlider* s = dynamic_cast<RefinedSlider*> (&slider))
  5. {
  6. const Image& sliderImg = s->sliderImage;
  7. const Image& vuImg = s->vuImage;
  8. jassert(sliderImg.getWidth() == vuImg.getWidth() && sliderImg.getHeight() == vuImg.getHeight());
  9. const int wSubImage = sliderImg.getWidth();
  10. const int numImages = sliderImg.getHeight() / wSubImage;
  11. const int ySliderImage = wSubImage * jlimit(0, numImages - 1, static_cast<int> (sliderPosProportional * (numImages - 1) + 0.5f));
  12. const int yVuImage = wSubImage * jlimit(0, numImages - 1, static_cast<int> (s->getVuValue() * (numImages - 1) + 0.5f));
  13. g.drawImage(sliderImg, x, y, width, height, 0, ySliderImage, wSubImage, wSubImage, false);
  14. g.drawImage(vuImg, x, y, width, height, 0, yVuImage, wSubImage, wSubImage, false);
  15. }
  16. }