r_attribs.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 internal method is invoked before drawing any polyline. It sets
  16. the relevant attributes of a ReGIS display to what they should be. */
  17. #include "sys-defines.h"
  18. #include "extern.h"
  19. /* ReGIS 8-bit `patterns', i.e., line types, indexed into by our internal
  20. line style number (PL_L_SOLID/PL_L_DOTTED/
  21. PL_L_DOTDASHED/PL_L_SHORTDASHED/PL_L_LONGDASHED/PL_L_DOTDOTDASHED/PL_L_DOTDOTDOTDASHED).
  22. ReGIS supports standard patterns P0..P9, and user-specified patterns
  23. made up of 2 to 8 bits. If fewer than 8 bits are supplied, ReGIS
  24. repeats as much of the pattern as possible in what remains of the 8-bit
  25. segment. Standard pattern P1 is solid. */
  26. static const char * const regis_line_types[PL_NUM_LINE_TYPES] =
  27. { "P1", "P1000", "P11100100", "P11110000", "P11111100", "P11101010", "P10" };
  28. void
  29. _pl_r_set_attributes (S___(Plotter *_plotter))
  30. {
  31. if (_plotter->regis_line_type_is_unknown
  32. || _plotter->regis_line_type != _plotter->drawstate->line_type)
  33. {
  34. char tmpbuf[32];
  35. sprintf (tmpbuf, "W(%s)\n",
  36. regis_line_types[_plotter->drawstate->line_type]);
  37. _write_string (_plotter->data, tmpbuf);
  38. _plotter->regis_line_type_is_unknown = false;
  39. _plotter->regis_line_type = _plotter->drawstate->line_type;
  40. }
  41. }