MandelVideoGenerator.h 1.5 KB

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