zeroline.ps 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. %!
  2. % Copyright (C) 1994 Aladdin Enterprises. All rights reserved.
  3. %
  4. % This file is part of AFPL Ghostscript.
  5. %
  6. % AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  7. % distributor accepts any responsibility for the consequences of using it, or
  8. % for whether it serves any particular purpose or works at all, unless he or
  9. % she says so in writing. Refer to the Aladdin Free Public License (the
  10. % "License") for full details.
  11. %
  12. % Every copy of AFPL Ghostscript must include a copy of the License, normally
  13. % in a plain ASCII text file named PUBLIC. The License grants you the right
  14. % to copy, modify and redistribute AFPL Ghostscript, but only under certain
  15. % conditions described in the License. Among other things, the License
  16. % requires that the copyright notice and this notice be preserved on all
  17. % copies.
  18. % $Id: zeroline.ps,v 1.2 2000/09/19 18:29:11 lpd Exp $
  19. % zeroline.ps
  20. % Test file to determine how other PostScript implementations handle
  21. % filling zero-width lines under a variety of conditions.
  22. % Add a small "fan" of zero-width lines at different angles to the path.
  23. /fan
  24. { currentpoint 100 0 rlineto
  25. 2 copy moveto 100 20 rlineto
  26. 2 copy moveto 100 100 rlineto
  27. 2 copy moveto 20 100 rlineto
  28. moveto 0 100 rlineto
  29. } def
  30. % Append a rectangle to the current path.
  31. /rectappend
  32. { 4 -2 roll moveto 1 index 0 rlineto 0 exch rlineto
  33. neg 0 rlineto closepath
  34. } def
  35. % Fill a rectangle.
  36. /rectfill
  37. { gsave newpath rectappend fill grestore
  38. } def
  39. % Stroke a rectangle.
  40. /rectstroke
  41. { gsave newpath rectappend stroke grestore
  42. } def
  43. % Clip to a rectangle. Unlike the real rectclip,
  44. % this clear the current path.
  45. /rectclip
  46. { newpath rectappend clip newpath
  47. } def
  48. 40 40 translate
  49. % Display fans of different colors on different backgrounds.
  50. gsave
  51. 0 setgray
  52. 0 0 120 120 rectstroke
  53. 10 10 moveto fan fill
  54. 140 0 translate
  55. 0 setgray
  56. 0 0 120 120 rectstroke
  57. 0.8 setgray
  58. 10 10 moveto fan fill
  59. 140 0 translate
  60. 0 setgray
  61. 0 0 120 120 rectfill
  62. 1 setgray
  63. 10 10 moveto fan fill
  64. grestore
  65. 0 140 translate
  66. % Display rectangles with two edges coincident.
  67. gsave
  68. newpath
  69. 0 setgray
  70. 0 0 40 40 rectappend
  71. 0 0 20 20 rectappend
  72. eofill
  73. 60 0 translate
  74. 0 0 40 40 rectappend
  75. 40 0 -20 20 rectappend
  76. fill
  77. grestore
  78. 0 60 translate
  79. % Display superimposed lines.
  80. gsave
  81. /super
  82. { currentpoint fan
  83. 2 copy moveto 20 0 rmoveto 50 0 rlineto
  84. 2 copy moveto 20 4 rmoveto 50 10 rlineto
  85. 2 copy moveto 20 20 rmoveto 50 50 rlineto
  86. 2 copy moveto 4 20 rmoveto 10 50 rlineto
  87. moveto 0 20 rmoveto 0 50 rlineto
  88. } def
  89. 0 setgray
  90. 0 0 moveto super fill
  91. 140 0 translate 0 0 moveto super eofill
  92. grestore
  93. 0 140 translate
  94. showpage