henesyinit from p9fd787fda5 years agoHistory
167 lines · 4.0 KB · Text
RawDownload
%!%   Copyright (C) 1989, 1990, 1992, 1994, 1996 Aladdin Enterprises.  All rights reserved.% % This file is part of Aladdin Ghostscript.% % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author% or distributor accepts any responsibility for the consequences of using it,% or for whether it serves any particular purpose or works at all, unless he% or she says so in writing.  Refer to the Aladdin Ghostscript Free Public% License (the "License") for full details.% % Every copy of Aladdin Ghostscript must include a copy of the License,% normally in a plain ASCII text file named PUBLIC.  The License grants you% the right to copy, modify and redistribute Aladdin Ghostscript, but only% under certain conditions described in the License.  Among other things, the% License requires that the copyright notice and this notice be preserved on% all copies. % $Id: lines.ps,v 1.1 2000/03/09 08:40:40 lpd Exp $% Test line rendering (stroke). % Exercise the miter limit.  The left column of lines should bevel at% 90 degrees, the right column at 60 degrees. gsave1.8 setlinewidth0 setgray15 15 scale-5 5 translate[1.415 2.0] { setmiterlimit 12 0 translate 0 0 moveto   10 30 360    { gsave 5 0 rlineto rotate 2.5 0 rlineto      gsave 0 setlinewidth 1 0 0 setrgbcolor stroke grestore      strokepath 0 setlinewidth stroke      grestore      0 4 rmoveto    } for } forall showpagegrestore % Exercise all the combinations of cap and join styles% for one-line, two-line, and closed paths. gsave /drawlines {gsave2.0 setmiterlimit2.0 setlinewidth6 6 scale5 20 translate{0 1 2}				% line cap { setlinecap gsave   {0 1 2}			% line join    { setlinejoin gsave      { {currentpoint lineto}	{3 7 lineto}	{3 7 lineto 5 1 lineto}	{3 7 lineto 6 3 lineto closepath}      }       { gsave 0 0 moveto exec         gsave stroke grestore	 0.5 setlinewidth 1 0 0 setrgbcolor stroke	 grestore 8 0 translate       } forall      grestore 35 0 translate    } forall   grestore 0 20 translate } forallgrestore} def/xflip { 8.5 72 mul 0 translate -1 1 scale } def/rot90 { 90 rotate 0 -9.75 72 mul translate } def/rot180 { rot90 rot90 } def/rot270 { rot180 rot90 } def drawlines showpagegsave xflip drawlines grestore showpagegsave rot90 drawlines grestore showpagegsave rot90 xflip drawlines grestore showpagegsave drawlines rot180 showpagegsave rot180 xflip drawlines grestore showpagegsave rot270 drawlines grestore showpagegsave rot270 xflip drawlines grestore showpagegrestore % Here are some boundary conditions, contributed by Mark Rawling. gsave1 setlinecap2.6 setmiterlimit3.0 setlinewidth 5 5 scale10 20 translate % [ 0.5 sqrt dup dup dup neg exch 0 0 ] concat	% 45 rotate {0 1 2}                        % line join{    setlinejoin gsave    0 0 moveto 0 10 lineto 10 0 lineto gsave stroke grestore    15 0 translate    0 0 moveto 0 10 lineto 10 20 lineto gsave stroke grestore    15 0 translate    10 0 moveto 10 10 lineto 0 20 lineto gsave stroke grestore    15 0 translate    10 0 moveto 10 10 lineto 0 0 lineto gsave stroke grestore    grestore    gsave    0 20 translate    0 20 moveto 0 10 lineto 10 20 lineto gsave stroke grestore    15 0 translate    0 20 moveto 0 10 lineto 10 0 lineto gsave stroke grestore    15 0 translate    10 20 moveto 10 10 lineto 0 0 lineto gsave stroke grestore    15 0 translate    10 20 moveto 10 10 lineto 0 20 lineto gsave stroke grestore    grestore 60 0 translate} forall showpagegrestore % Test narrow lines at a variety of angles. gsave /rad 120 def/ray { gsave rotate 0 0 moveto rad 0 rlineto stroke grestore } def/star { newpath gsave   gsave 0.5 setgray 0 0 rad 0 360 arc stroke grestore   0 90 359    { rotate       0 3 14 { ray } for      15 15 89 { ray } for    } for   grestore } def 0 setgray150 150 translate[ [ 0 0.5 1 ] [ 1.5 2 2.5 ] [ 3 3.5 4 ] ] { gsave    { setlinewidth star      250 0 translate    } forall   grestore 0 250 translate } forall grestore showpage % End quit