c_erase.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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_c_erase_page (S___(Plotter *_plotter))
  19. {
  20. int i;
  21. /* reinitialize `font used' array(s) for this page */
  22. for (i = 0; i < PL_NUM_PS_FONTS; i++)
  23. _plotter->data->page->ps_font_used[i] = false;
  24. /* deallocate table of user-specified line types, if any */
  25. if (_plotter->data->page->extra)
  26. {
  27. plCGMCustomLineType *linetype_ptr = (plCGMCustomLineType *)_plotter->data->page->extra;
  28. plCGMCustomLineType *old_linetype_ptr;
  29. while (linetype_ptr)
  30. {
  31. if (linetype_ptr->dash_array_len > 0 /* paranoia */
  32. && linetype_ptr->dashes)
  33. free (linetype_ptr->dashes);
  34. old_linetype_ptr = linetype_ptr;
  35. linetype_ptr = linetype_ptr->next;
  36. free (old_linetype_ptr);
  37. }
  38. _plotter->data->page->extra = (void *)NULL;
  39. }
  40. /* reset other page-specific, i.e. picture-specific, CGMPlotter
  41. variables, as if the page had just been opened */
  42. _plotter->cgm_page_version = 1;
  43. _plotter->cgm_page_profile = CGM_PROFILE_WEB;
  44. _plotter->cgm_page_need_color = false;
  45. /* colors */
  46. _plotter->cgm_line_color.red = -1;
  47. _plotter->cgm_line_color.green = -1;
  48. _plotter->cgm_line_color.blue = -1;
  49. _plotter->cgm_edge_color.red = -1;
  50. _plotter->cgm_edge_color.green = -1;
  51. _plotter->cgm_edge_color.blue = -1;
  52. _plotter->cgm_fillcolor.red = -1;
  53. _plotter->cgm_fillcolor.green = -1;
  54. _plotter->cgm_fillcolor.blue = -1;
  55. _plotter->cgm_marker_color.red = -1;
  56. _plotter->cgm_marker_color.green = -1;
  57. _plotter->cgm_marker_color.blue = -1;
  58. _plotter->cgm_text_color.red = -1;
  59. _plotter->cgm_text_color.green = -1;
  60. _plotter->cgm_text_color.blue = -1;
  61. _plotter->cgm_bgcolor.red = -1;
  62. _plotter->cgm_bgcolor.green = -1;
  63. _plotter->cgm_bgcolor.blue = -1;
  64. /* other dynamic variables */
  65. _plotter->cgm_line_type = CGM_L_SOLID;
  66. _plotter->cgm_dash_offset = 0.0;
  67. _plotter->cgm_join_style = CGM_JOIN_UNSPEC;
  68. _plotter->cgm_cap_style = CGM_CAP_UNSPEC;
  69. _plotter->cgm_dash_cap_style = CGM_CAP_UNSPEC;
  70. /* CGM's default line width: 1/1000 times the max VDC dimension */
  71. _plotter->cgm_line_width = (1 << (8*CGM_BINARY_BYTES_PER_INTEGER - 3)) / 500;
  72. _plotter->cgm_interior_style = CGM_INT_STYLE_HOLLOW;
  73. _plotter->cgm_edge_type = CGM_L_SOLID;
  74. _plotter->cgm_edge_dash_offset = 0.0;
  75. _plotter->cgm_edge_join_style = CGM_JOIN_UNSPEC;
  76. _plotter->cgm_edge_cap_style = CGM_CAP_UNSPEC;
  77. _plotter->cgm_edge_dash_cap_style = CGM_CAP_UNSPEC;
  78. /* CGM's default edge width: 1/1000 times the max VDC dimension */
  79. _plotter->cgm_edge_width = (1 << (8*CGM_BINARY_BYTES_PER_INTEGER - 3)) / 500;
  80. _plotter->cgm_edge_is_visible = false;
  81. _plotter->cgm_miter_limit = 32767.0;
  82. _plotter->cgm_marker_type = CGM_M_ASTERISK;
  83. /* CGM's default marker size: 1/1000 times the max VDC dimension */
  84. _plotter->cgm_marker_size = (1 << (8*CGM_BINARY_BYTES_PER_INTEGER - 3)) /500;
  85. /* label-related variables */
  86. _plotter->cgm_char_height = -1; /* impossible (dummy) value */
  87. _plotter->cgm_char_base_vector_x = 1;
  88. _plotter->cgm_char_base_vector_y = 0;
  89. _plotter->cgm_char_up_vector_x = 0;
  90. _plotter->cgm_char_up_vector_y = 1;
  91. _plotter->cgm_horizontal_text_alignment = CGM_ALIGN_NORMAL_HORIZONTAL;
  92. _plotter->cgm_vertical_text_alignment = CGM_ALIGN_NORMAL_VERTICAL;
  93. _plotter->cgm_font_id = -1; /* impossible (dummy) value */
  94. _plotter->cgm_charset_lower = 0; /* dummy value (we use values 1..4) */
  95. _plotter->cgm_charset_upper = 0; /* dummy value (we use values 1..4) */
  96. _plotter->cgm_restricted_text_type = CGM_RESTRICTED_TEXT_TYPE_BASIC;
  97. /* copy the bg color currently in the drawing state to the CGM-specific
  98. part of the CGMPlotter; it'll be written to the output file at the
  99. head of the picture */
  100. _pl_c_set_bg_color (S___(_plotter));
  101. return true;
  102. }