QueueManager.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. #ifndef QUEUEMANAGER_H_
  3. #define QUEUEMANAGER_H_
  4. #include <cinttypes>
  5. #include <vector>
  6. #include <future>
  7. #include "Bitmap.h"
  8. struct MandelViewport
  9. {
  10. /// real part of the top left corner
  11. double x = -2.1;
  12. /// imaginary part of the top left corner
  13. double y = -1.5;
  14. /// real-part span of the picture to be generated
  15. double width = 3;
  16. /// imaginary-part span of the picture to be generated
  17. double height = 3;
  18. /*!
  19. * \brief adjusts the aspect ratio of the viewport, making sure
  20. * the updated viewport contains all of the original one.
  21. */
  22. void adjustAspectRatio(double nwidth, double nheight);
  23. };
  24. struct MandelInfo
  25. {
  26. /// viewport
  27. MandelViewport view;
  28. /// width of the bitmap to be generated
  29. long bWidth;
  30. /// height of the bitmap to be generated
  31. long bHeight;
  32. /// maximum iterations
  33. int maxIter;
  34. };
  35. class MandelGenerator
  36. {
  37. public:
  38. MandelGenerator(void) = default;
  39. virtual ~MandelGenerator(void);
  40. virtual Bitmap<RGBColor> generate(const MandelInfo& mandelInfo);
  41. virtual Bitmap<float> generateRaw(const MandelInfo& info) = 0;
  42. };
  43. class QueueManager
  44. {
  45. public:
  46. QueueManager(void);
  47. ~QueueManager(void);
  48. std::future<Bitmap<RGBColor>> generate(const MandelInfo& mandelInfo);
  49. };
  50. #endif // QUEUEMANAGER_H_