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
22 bool
_pl_m_begin_page(S___ (Plotter * _plotter))23 _pl_m_begin_page (S___(Plotter *_plotter))
24 {
25 if (_plotter->data->page_number == 1)
26 /* emit metafile header, i.e. magic string */
27 {
28 _write_string (_plotter->data, PL_PLOT_MAGIC);
29
30 /* format type 1 = GNU binary, type 2 = GNU portable */
31 if (_plotter->meta_portable_output)
32 _write_string (_plotter->data, " 2\n");
33 else
34 _write_string (_plotter->data, " 1\n");
35 }
36
37 _pl_m_emit_op_code (R___(_plotter) O_OPENPL);
38 _pl_m_emit_terminator (S___(_plotter));
39
40 /* reset page-specific, i.e. picture-specific, dynamic variables */
41 _plotter->meta_pos.x = 0.0;
42 _plotter->meta_pos.y = 0.0;
43 _plotter->meta_position_is_unknown = false;
44 _plotter->meta_m_user_to_ndc[0] = 1.0;
45 _plotter->meta_m_user_to_ndc[1] = 0.0;
46 _plotter->meta_m_user_to_ndc[2] = 0.0;
47 _plotter->meta_m_user_to_ndc[3] = 1.0;
48 _plotter->meta_m_user_to_ndc[4] = 0.0;
49 _plotter->meta_m_user_to_ndc[5] = 0.0;
50 _plotter->meta_fill_rule_type = PL_FILL_ODD_WINDING;
51 _plotter->meta_line_type = PL_L_SOLID;
52 _plotter->meta_points_are_connected = true;
53 _plotter->meta_cap_type = PL_CAP_BUTT;
54 _plotter->meta_join_type = PL_JOIN_MITER;
55 _plotter->meta_miter_limit = PL_DEFAULT_MITER_LIMIT;
56 _plotter->meta_line_width = 0.0;
57 _plotter->meta_line_width_is_default = true;
58 _plotter->meta_dash_array = (const double *)NULL;
59 _plotter->meta_dash_array_len = 0;
60 _plotter->meta_dash_offset = 0.0;
61 _plotter->meta_dash_array_in_effect = false;
62 _plotter->meta_pen_type = 1;
63 _plotter->meta_fill_type = 0;
64 _plotter->meta_orientation = 1;
65 _plotter->meta_font_name = (const char *)NULL;
66 _plotter->meta_font_size = 0.0;
67 _plotter->meta_font_size_is_default = true;
68 _plotter->meta_text_rotation = 0.0;
69 _plotter->meta_fgcolor.red = 0;
70 _plotter->meta_fgcolor.green = 0;
71 _plotter->meta_fgcolor.blue = 0;
72 _plotter->meta_fillcolor_base.red = 0;
73 _plotter->meta_fillcolor_base.green = 0;
74 _plotter->meta_fillcolor_base.blue = 0;
75 _plotter->meta_bgcolor.red = 65535;
76 _plotter->meta_bgcolor.green = 65535;
77 _plotter->meta_bgcolor.blue = 65535;
78
79 return true;
80 }
81