i_erase.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* This file is part of the GNU plotutils package. Copyright (C) 1995,
  2. 1996, 1997, 1998, 1999, 2000, 2005, 2008, Free Software Foundation, Inc.
  3. The GNU plotutils package is free software. You may redistribute it
  4. and/or modify it under the terms of the GNU General Public License as
  5. published by the Free Software foundation; either version 2, or (at your
  6. option) any later version.
  7. The GNU plotutils package is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. You should have received a copy of the GNU General Public License along
  12. with the GNU plotutils package; see the file COPYING. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
  14. Boston, MA 02110-1301, USA. */
  15. #include "sys-defines.h"
  16. #include "extern.h"
  17. bool
  18. _pl_i_erase_page (S___(Plotter *_plotter))
  19. {
  20. /* If we're animating, emit the GIF header, and emit the just-finished
  21. frame as one of the images in the animated GIF. But don't do this
  22. for the zeroth frame unless it's nonempty. */
  23. if (_plotter->i_animation && _plotter->data->page_number == 1 && _plotter->data->outfp
  24. && (_plotter->data->frame_number > 0 || _plotter->i_frame_nonempty))
  25. {
  26. if (_plotter->i_header_written == false)
  27. {
  28. _pl_i_write_gif_header (S___(_plotter));
  29. _plotter->i_header_written = true;
  30. }
  31. /* emit image using RLE module (see i_rle.c) */
  32. _pl_i_write_gif_image (S___(_plotter));
  33. }
  34. /* delete image: deallocate frame's libxmi canvas, reset frame's color
  35. table */
  36. _pl_i_delete_image (S___(_plotter));
  37. /* Create new image, consisting of libxmi canvas and colormap;
  38. initialized to background color. First entries in the color table
  39. will be (1) transparent color [if there is one, and we're animating]
  40. and (2) background color. */
  41. _pl_i_new_image (S___(_plotter));
  42. /* next frame will start empty */
  43. _plotter->i_frame_nonempty = false;
  44. return true;
  45. }