QueueManager.cpp 768 B

12345678910111213141516171819202122232425262728293031
  1. #include "QueueManager.h"
  2. #include <cmath>
  3. void MandelViewport::adjustAspectRatio(double nwidth, double nheight)
  4. {
  5. double otherRatio = nwidth / nheight;
  6. if (width < height * otherRatio)
  7. width = height * otherRatio;
  8. else if (height < width / otherRatio)
  9. height = width / otherRatio;
  10. }
  11. MandelGenerator::~MandelGenerator(void)
  12. {
  13. }
  14. Bitmap<RGBColor> MandelGenerator::generate(const MandelInfo& mandelInfo)
  15. {
  16. auto converter = [](float i) { return i < 0 ? RGBColor{ 0,0,0 } : RGBColor{ uint8_t(cos(i * 0.15f) * 127 + 127), uint8_t(sin(i * 0.01f) * 127 + 127), uint8_t(sin(i * 0.04f) * 127 + 127) }; };
  17. return generateRaw(mandelInfo).map<RGBColor>(converter);
  18. }
  19. QueueManager::QueueManager()
  20. {
  21. }
  22. QueueManager::~QueueManager()
  23. {
  24. }