c_openpl.c 4.3 KB

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