You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.2 KiB

1 month ago
  1. %!
  2. % Copyright (C) 2001-2023 Artifex Software, Inc.
  3. % All Rights Reserved.
  4. %
  5. % This software is provided AS-IS with no warranty, either express or
  6. % implied.
  7. %
  8. % This software is distributed under license and may not be copied,
  9. % modified or distributed except as expressly authorized under the terms
  10. % of the license contained in the file LICENSE in this distribution.
  11. %
  12. % Refer to licensing information at http://www.artifex.com or contact
  13. % Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  14. % CA 94129, USA, for further information.
  15. %
  16. % zeroline.ps
  17. % Test file to determine how other PostScript implementations handle
  18. % filling zero-width lines under a variety of conditions.
  19. % Add a small "fan" of zero-width lines at different angles to the path.
  20. /fan
  21. { currentpoint 100 0 rlineto
  22. 2 copy moveto 100 20 rlineto
  23. 2 copy moveto 100 100 rlineto
  24. 2 copy moveto 20 100 rlineto
  25. moveto 0 100 rlineto
  26. } def
  27. % Append a rectangle to the current path.
  28. /rectappend
  29. { 4 -2 roll moveto 1 index 0 rlineto 0 exch rlineto
  30. neg 0 rlineto closepath
  31. } def
  32. % Fill a rectangle.
  33. /rectfill
  34. { gsave newpath rectappend fill grestore
  35. } def
  36. % Stroke a rectangle.
  37. /rectstroke
  38. { gsave newpath rectappend stroke grestore
  39. } def
  40. % Clip to a rectangle. Unlike the real rectclip,
  41. % this clear the current path.
  42. /rectclip
  43. { newpath rectappend clip newpath
  44. } def
  45. 40 40 translate
  46. % Display fans of different colors on different backgrounds.
  47. gsave
  48. 0 setgray
  49. 0 0 120 120 rectstroke
  50. 10 10 moveto fan fill
  51. 140 0 translate
  52. 0 setgray
  53. 0 0 120 120 rectstroke
  54. 0.8 setgray
  55. 10 10 moveto fan fill
  56. 140 0 translate
  57. 0 setgray
  58. 0 0 120 120 rectfill
  59. 1 setgray
  60. 10 10 moveto fan fill
  61. grestore
  62. 0 140 translate
  63. % Display rectangles with two edges coincident.
  64. gsave
  65. newpath
  66. 0 setgray
  67. 0 0 40 40 rectappend
  68. 0 0 20 20 rectappend
  69. eofill
  70. 60 0 translate
  71. 0 0 40 40 rectappend
  72. 40 0 -20 20 rectappend
  73. fill
  74. grestore
  75. 0 60 translate
  76. % Display superimposed lines.
  77. gsave
  78. /super
  79. { currentpoint fan
  80. 2 copy moveto 20 0 rmoveto 50 0 rlineto
  81. 2 copy moveto 20 4 rmoveto 50 10 rlineto
  82. 2 copy moveto 20 20 rmoveto 50 50 rlineto
  83. 2 copy moveto 4 20 rmoveto 10 50 rlineto
  84. moveto 0 20 rmoveto 0 50 rlineto
  85. } def
  86. 0 setgray
  87. 0 0 moveto super fill
  88. 140 0 translate 0 0 moveto super eofill
  89. grestore
  90. 0 140 translate
  91. showpage