12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #pragma once
- #ifndef QUEUEMANAGER_H_
- #define QUEUEMANAGER_H_
- #include <cinttypes>
- #include <vector>
- #include <future>
- #include "Bitmap.h"
- struct MandelViewport
- {
- /// real part of the top left corner
- double x = -2.1;
- /// imaginary part of the top left corner
- double y = -1.5;
- /// real-part span of the picture to be generated
- double width = 3;
- /// imaginary-part span of the picture to be generated
- double height = 3;
- /*!
- * \brief adjusts the aspect ratio of the viewport, making sure
- * the updated viewport contains all of the original one.
- */
- void adjustAspectRatio(double nwidth, double nheight);
- /*!
- * \brief make sure width and height are positive
- */
- void normalize(void);
- };
- struct MandelInfo
- {
- /// viewport
- MandelViewport view;
- /// width of the bitmap to be generated
- long bWidth;
- /// height of the bitmap to be generated
- long bHeight;
-
- /// maximum iterations
- int maxIter;
- };
- class MandelGenerator
- {
- public:
- MandelGenerator(void) = default;
- virtual ~MandelGenerator(void);
- virtual Bitmap<RGBColor> generate(const MandelInfo& mandelInfo);
- virtual Bitmap<float> generateRaw(const MandelInfo& info) = 0;
- };
- class QueueManager
- {
- public:
- QueueManager(void);
- ~QueueManager(void);
- std::future<Bitmap<RGBColor>> generate(const MandelInfo& mandelInfo);
- };
- #endif // QUEUEMANAGER_H_
|