main.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Copyright (C) 2010-2011 Matthias Kretz <kretz@kde.org>
  3. Permission to use, copy, modify, and distribute this software
  4. and its documentation for any purpose and without fee is hereby
  5. granted, provided that the above copyright notice appear in all
  6. copies and that both that the copyright notice and this
  7. permission notice and warranty disclaimer appear in supporting
  8. documentation, and that the name of the author not be used in
  9. advertising or publicity pertaining to distribution of the
  10. software without specific, written prior permission.
  11. The author disclaim all warranties with regard to this
  12. software, including all implied warranties of merchantability
  13. and fitness. In no event shall the author be liable for any
  14. special, indirect or consequential damages or any damages
  15. whatsoever resulting from loss of use, data or profits, whether
  16. in an action of contract, negligence or other tortious action,
  17. arising out of or in connection with the use or performance of
  18. this software.
  19. */
  20. #ifndef MAIN_H
  21. #define MAIN_H
  22. #include <QImage>
  23. #include <QTextStream>
  24. #include <QString>
  25. #include <QObject>
  26. class ProgressWriter
  27. {
  28. public:
  29. ProgressWriter();
  30. void setValue(float v);
  31. void done();
  32. private:
  33. QTextStream m_out;
  34. };
  35. class Baker
  36. {
  37. public:
  38. struct Options
  39. {
  40. int red[2];
  41. int green[2];
  42. int blue[2];
  43. int steps[2];
  44. int it[2];
  45. Options();
  46. };
  47. Baker();
  48. void setOptions(Options o) { m_opt = o; }
  49. void setSize(int w, int h);
  50. void setFilename(const QString &);
  51. void createImage();
  52. private:
  53. Options m_opt;
  54. float m_x; // left
  55. float m_y; // top
  56. float m_width;
  57. float m_height;
  58. QImage m_image;
  59. QString m_filename;
  60. ProgressWriter m_progress;
  61. };
  62. #endif // MAIN_H