1
0

zeroline.ps 2.4 KB

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