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
4 The GNU plotutils package is free software. You may redistribute it
5 and/or modify it under the terms of the GNU General Public License as
6 published by the Free Software foundation; either version 2, or (at your
7 option) any later version.
8
9 The GNU plotutils package is distributed in the hope that it will be
10 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with the GNU plotutils package; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
17 Boston, MA 02110-1301, USA. */
18
19 #include "sys-defines.h"
20 #include "extern.h"
21 #include "xmi.h"
22
23 bool
_pl_b_end_page(S___ (Plotter * _plotter))24 _pl_b_end_page (S___(Plotter *_plotter))
25 {
26 int retval;
27
28 /* Possibly output the page's bitmap. In the base BitmapPlotter class
29 this is a no-op (see below), but it may do something in derived
30 classes. */
31 retval = _maybe_output_image (S___(_plotter));
32
33 /* tear down */
34 _pl_b_delete_image (S___(_plotter));
35
36 return (retval < 0 ? false : true);
37 }
38
39 /* tear down image, i.e. deallocate libxmi canvas */
40 void
_pl_b_delete_image(S___ (Plotter * _plotter))41 _pl_b_delete_image (S___(Plotter *_plotter))
42 {
43 /* deallocate libxmi's drawing canvas (and painted set struct too) */
44 miDeleteCanvas ((miCanvas *)_plotter->b_canvas);
45 _plotter->b_canvas = (void *)NULL;
46 miDeletePaintedSet ((miPaintedSet *)_plotter->b_painted_set);
47 _plotter->b_painted_set = (void *)NULL;
48 }
49
50 /* This is the BitmapPlotter-specific version of the _maybe_output_image()
51 method, which is invoked when a page is finished. It's a no-op; in
52 derived classes such as the PNMPlotter and PNGPlotter classes, it's
53 overridden by a version that actually does something. */
54
55 int
_pl_b_maybe_output_image(S___ (Plotter * _plotter))56 _pl_b_maybe_output_image (S___(Plotter *_plotter))
57 {
58 return 0;
59 }
60
61