MandelVideoGenerator.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef MANDELVIDEOGENERATOR_H
  2. #define MANDELVIDEOGENERATOR_H
  3. #include "Mandel.h"
  4. #include "Gradient.h"
  5. #include "Bitmap.h"
  6. #include <functional>
  7. struct ExportVideoInfo
  8. {
  9. /// the viewport at the start of the video
  10. mnd::MandelViewport start;
  11. /// the viewport at the end of the video
  12. mnd::MandelViewport end;
  13. /// Info struct to hold further data about the generation
  14. /// of mandelbrot images. The Viewport specified in this
  15. /// struct is ignored.
  16. mnd::MandelInfo mi;
  17. /// the gradient to use
  18. Gradient gradient;
  19. int fps;
  20. double zoomSpeed;
  21. std::string path;
  22. /// bitrate in kbps
  23. int bitrate;
  24. std::string preset;
  25. };
  26. struct MandelVideoProgressInfo
  27. {
  28. int64_t framesExported;
  29. float progress;
  30. };
  31. class MandelVideoGenerator
  32. {
  33. public:
  34. using ProgressCallback = std::function<void(const MandelVideoProgressInfo&)>;
  35. private:
  36. const ExportVideoInfo evi;
  37. std::vector<ProgressCallback> progressCallbacks;
  38. public:
  39. MandelVideoGenerator(const ExportVideoInfo& evi);
  40. void generate(mnd::MandelGenerator& gen);
  41. void addProgressCallback(ProgressCallback pc);
  42. private:
  43. void callCallbacks(const MandelVideoProgressInfo& evi);
  44. Bitmap<RGBColor> overlay(const Bitmap<RGBColor>& outer,
  45. const Bitmap<RGBColor>& inner,
  46. long bw, long bh,
  47. double scale, double oversizeFactor);
  48. };
  49. #endif // MANDELVIDEOGENERATOR_H