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 /* This version is for CGM Plotters, which graphics only after all pages of
20 graphics have been drawn, and the Plotter is deleted. */
21
22 #include "sys-defines.h"
23 #include "extern.h"
24
25 bool
_pl_c_begin_page(S___ (Plotter * _plotter))26 _pl_c_begin_page (S___(Plotter *_plotter))
27 {
28 int i;
29
30 /* CGM Plotters use the `extra' field of their single plOutbuf (a void
31 pointer; it points to the head of a linked list of user-defined line
32 types for the page) */
33 _plotter->data->page->extra = (void *)NULL;
34
35 /* initialize `font used' array(s) for this page */
36 for (i = 0; i < PL_NUM_PS_FONTS; i++)
37 _plotter->data->page->ps_font_used[i] = false;
38
39 /* reset page-specific, i.e. picture-specific, dynamic variables */
40 _plotter->cgm_page_version = 1;
41 _plotter->cgm_page_profile = CGM_PROFILE_WEB;
42 _plotter->cgm_page_need_color = false;
43 /* colors */
44 _plotter->cgm_line_color.red = -1;
45 _plotter->cgm_line_color.green = -1;
46 _plotter->cgm_line_color.blue = -1;
47 _plotter->cgm_edge_color.red = -1;
48 _plotter->cgm_edge_color.green = -1;
49 _plotter->cgm_edge_color.blue = -1;
50 _plotter->cgm_fillcolor.red = -1;
51 _plotter->cgm_fillcolor.green = -1;
52 _plotter->cgm_fillcolor.blue = -1;
53 _plotter->cgm_marker_color.red = -1;
54 _plotter->cgm_marker_color.green = -1;
55 _plotter->cgm_marker_color.blue = -1;
56 _plotter->cgm_text_color.red = -1;
57 _plotter->cgm_text_color.green = -1;
58 _plotter->cgm_text_color.blue = -1;
59 _plotter->cgm_bgcolor.red = -1;
60 _plotter->cgm_bgcolor.green = -1;
61 _plotter->cgm_bgcolor.blue = -1;
62 /* other dynamic variables */
63 _plotter->cgm_line_type = CGM_L_SOLID;
64 _plotter->cgm_dash_offset = 0.0;
65 _plotter->cgm_join_style = CGM_JOIN_UNSPEC;
66 _plotter->cgm_cap_style = CGM_CAP_UNSPEC;
67 _plotter->cgm_dash_cap_style = CGM_CAP_UNSPEC;
68 /* CGM's default line width: 1/1000 times the max VDC dimension */
69 _plotter->cgm_line_width = (1 << (8*CGM_BINARY_BYTES_PER_INTEGER - 3)) / 500;
70 _plotter->cgm_interior_style = CGM_INT_STYLE_HOLLOW;
71 _plotter->cgm_edge_type = CGM_L_SOLID;
72 _plotter->cgm_edge_dash_offset = 0.0;
73 _plotter->cgm_edge_join_style = CGM_JOIN_UNSPEC;
74 _plotter->cgm_edge_cap_style = CGM_CAP_UNSPEC;
75 _plotter->cgm_edge_dash_cap_style = CGM_CAP_UNSPEC;
76 /* CGM's default edge width: 1/1000 times the max VDC dimension */
77 _plotter->cgm_edge_width = (1 << (8*CGM_BINARY_BYTES_PER_INTEGER - 3)) / 500;
78 _plotter->cgm_edge_is_visible = false;
79 _plotter->cgm_miter_limit = 32767.0;
80 _plotter->cgm_marker_type = CGM_M_ASTERISK;
81 /* CGM's default marker size: 1/1000 times the max VDC dimension */
82 _plotter->cgm_marker_size = (1 << (8*CGM_BINARY_BYTES_PER_INTEGER - 3)) /500;
83 /* label-related variables */
84 _plotter->cgm_char_height = -1; /* impossible (dummy) value */
85 _plotter->cgm_char_base_vector_x = 1;
86 _plotter->cgm_char_base_vector_y = 0;
87 _plotter->cgm_char_up_vector_x = 0;
88 _plotter->cgm_char_up_vector_y = 1;
89 _plotter->cgm_horizontal_text_alignment = CGM_ALIGN_NORMAL_HORIZONTAL;
90 _plotter->cgm_vertical_text_alignment = CGM_ALIGN_NORMAL_VERTICAL;
91 _plotter->cgm_font_id = -1; /* impossible (dummy) value */
92 _plotter->cgm_charset_lower = 0; /* dummy value (we use values 1..4) */
93 _plotter->cgm_charset_upper = 0; /* dummy value (we use values 1..4) */
94 _plotter->cgm_restricted_text_type = CGM_RESTRICTED_TEXT_TYPE_BASIC;
95
96 /* copy background color to the CGM-specific part of the CGMPlotter;
97 it'll be written to the output file at the head of the picture */
98 _pl_c_set_bg_color (S___(_plotter));
99
100 return true;
101 }
102