g_dash2.c 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 file defines GNU libplot's builtin line styles. A line style is
  16. specified by invoking the linemod() operation. The supported line
  17. styles are a superset of the line styles of traditional (Unix) libplot.
  18. Unix libplot originated at Bell Labs in the early 1970's, and the first
  19. supported display device was a Tektronix 611 storage scope. The libplot
  20. API did not originally include linemod(), as the Unix Version 5 manual
  21. makes clear. That is because the Tektronix 611 did not have any
  22. predefined set of line styles. linemod() was added to the API slightly
  23. later, when it was extended to support the Tektronix 4010/4014 storage
  24. scope. The 4010/4014 provided hardware support for the five line styles
  25. "solid" through "longdashed".
  26. GNU libplot supports the traditional five, and also two additional line
  27. styles, "dotdotdashed" and "dotdotdotdashed". Each non-solid style is
  28. defined as a dash pattern, with the length of each dash (drawn or not
  29. drawn) being an integer multiple of the line width. This `scaling by
  30. line width' applies for sufficiently wide lines, at least.
  31. GNU libplot also supports a special "disconnected" line style (if a path
  32. is disconnected, it's drawn as a sequence of filled circles, one at each
  33. of the path join points). */
  34. #include "sys-defines.h"
  35. #include "extern.h"
  36. /* An array of dashes for each line type (dashes are cylically used,
  37. on/off/on/off...). Types must appear in a special order: it must agree
  38. with our internal numbering, i.e. must agree with the definitions of
  39. L_{SOLID,DOTTED,DOTDASHED,SHORTDASHED,LONGDASHED,DOTDOTDASHED etc.} in
  40. extern.h, which are 0,1,2,3,4,5 etc. respectively. */
  41. const plLineStyle _pl_g_line_styles[PL_NUM_LINE_TYPES] =
  42. /* Dash arrays for "dotted" through "longdashed" below are those used by
  43. the Tektronix emulator in xterm(1), except that the emulator seems
  44. incorrectly to have on and off interchanged (!). */
  45. {
  46. { "solid", PL_L_SOLID, 0, {0} }, /* dummy */
  47. { "dotted", PL_L_DOTTED, 2, {1, 3} },
  48. { "dotdashed", PL_L_DOTDASHED, 4, {4, 3, 1, 3} },
  49. { "shortdashed", PL_L_SHORTDASHED, 2, {4, 4} },
  50. { "longdashed", PL_L_LONGDASHED, 2, {7, 4} },
  51. { "dotdotdashed", PL_L_DOTDOTDASHED, 6, {4, 3, 1, 3, 1, 3} },
  52. { "dotdotdotdashed", PL_L_DOTDOTDOTDASHED, 8, {4, 3, 1, 3, 1, 3, 1, 3} }
  53. };
  54. /* N.B. `ps4014', the Tektronix->PS translator in Adobe's Transcript
  55. package, uses { 1, 2 }, { 8, 2, 1, 2 }, { 2, 2 }, { 12, 2 } for
  56. "dotted" through "longdashed", instead. */
  57. /* N.B. A genuine Tektronix 4014 (with Enhanced Graphics Module) uses
  58. { 1, 1 }, { 5, 1, 1, 1 }, { 3, 1 }, { 6, 2 } for "dotted"
  59. through "longdashed", instead. See the Tektronix 4014 Service
  60. Instruction Manual (dated Aug. 1974) for the diode array that produces
  61. these patterns. */