Artword_Speaker.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Artword_Speaker.cpp
  2. *
  3. * Copyright (C) 1992-2005,2011,2015-2017 Paul Boersma
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "Art_Speaker.h"
  19. #include "Artword_Speaker.h"
  20. void Artword_Speaker_draw (Artword artword, Speaker speaker, Graphics g, int numberOfSteps) {
  21. double oldLineWidth = Graphics_inqLineWidth (g);
  22. autoArt art = Art_create ();
  23. for (int i = 0; i <= numberOfSteps; i ++) {
  24. Artword_intoArt (artword, art.get(), i * artword -> totalTime / numberOfSteps);
  25. Graphics_setLineWidth (g, 2 + i + i);
  26. Art_Speaker_draw (art.get(), speaker, g);
  27. }
  28. Graphics_setLineWidth (g, oldLineWidth);
  29. }
  30. void Artword_Speaker_movie (Artword artword, Speaker speaker, Graphics graphics) {
  31. constexpr double timeStep = 0.03;
  32. autoArt art = Art_create ();
  33. for (double tim = 0.0; tim < artword -> totalTime; tim += timeStep) {
  34. Artword_intoArt (artword, art.get(), tim);
  35. Graphics_beginMovieFrame (graphics, & Graphics_WHITE);
  36. Graphics_setWindow (graphics, 0.0, 1.0, 0.0, 1.0);
  37. Art_Speaker_draw (art.get(), speaker, graphics);
  38. Graphics_endMovieFrame (graphics, timeStep);
  39. }
  40. }
  41. /* End of file Artword_Speaker.cpp */