使用 postscript 'clip' 命令打印文档中的多个字段的正确技术是什么?
What is the proper technique for using the postscript 'clip' command to print multiple fields within a document?
我的第一个剪辑似乎工作正常,但第二个字符串根本不打印。
newpath
20 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath clip
20 20 moveto
(Hello World) show
newpath
80 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath clip
80 20 moveto
(Hello Again) show
第一个剪辑允许在封闭区域内绘画。第二个剪辑已经在允许的区域之外。请参阅 PostScript 语言参考手册:
PSLRM3 at 4.4.2 Clipping Path:
The graphics state also contains a clipping path that limits the regions of the page
affected by the painting operators. The closed subpaths of this path define the
area that can be painted. Marks falling inside this area will be applied to the page;
those falling outside it will not.
Clip: There is no way to enlarge the current clipping path (other than by initclip or initgraphics) or to set a new clipping path without reference to the current one. The recommended way of using clip is to bracket the clip and the sequence of graphics to be clipped with gsave and grestore. The grestore will restore the clipping path that was in effect before the gsave. The setgstate operator can also be used to reset the clipping path to an earlier state.
编辑:
这可能有用:
%!
/Helvetica 12 selectfont
gsave
20 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath
80 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath
clip
clippath 0.8 setgray fill
0 setgray
20 20 moveto
(Hello World) show
80 20 moveto
(Hello Again and Again) show
grestore
showpage
我相信您对剪切路径的效果的看法是错误的。
如果设置了裁剪路径,它将影响并裁剪后面的所有绘画操作。 IE。所有绘画操作(填充、描边、显示等)仅限于在执行它们时生效的当前剪辑路径内绘画。您可以在该绘画操作后通过调用 grestore 删除剪辑路径,并为下一个绘画操作设置一个新剪辑路径。
/Helvetica 12 selectfont
gsave
<construct the desired clip path with moveto, lineto, whatever>
clip
newpath
20 20 moveto
(Hello!) show % cannot paint outside the current clippath
grestore
% now no clippath is in effect
gsave
<construct the desired clip path somewhere else>
clip
newpath
80 20 moveto
(Hello again!) show
grestore
请注意,与描边或填充等不同,剪辑运算符不会删除当前路径,这就是剪辑运算符几乎总是跟在新路径运算符之后的原因。
我的第一个剪辑似乎工作正常,但第二个字符串根本不打印。
newpath
20 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath clip
20 20 moveto
(Hello World) show
newpath
80 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath clip
80 20 moveto
(Hello Again) show
第一个剪辑允许在封闭区域内绘画。第二个剪辑已经在允许的区域之外。请参阅 PostScript 语言参考手册:
PSLRM3 at 4.4.2 Clipping Path: The graphics state also contains a clipping path that limits the regions of the page affected by the painting operators. The closed subpaths of this path define the area that can be painted. Marks falling inside this area will be applied to the page; those falling outside it will not.
Clip: There is no way to enlarge the current clipping path (other than by initclip or initgraphics) or to set a new clipping path without reference to the current one. The recommended way of using clip is to bracket the clip and the sequence of graphics to be clipped with gsave and grestore. The grestore will restore the clipping path that was in effect before the gsave. The setgstate operator can also be used to reset the clipping path to an earlier state.
编辑: 这可能有用:
%!
/Helvetica 12 selectfont
gsave
20 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath
80 20 moveto
0 24 rlineto
50 0 rlineto
0 -24 rlineto
closepath
clip
clippath 0.8 setgray fill
0 setgray
20 20 moveto
(Hello World) show
80 20 moveto
(Hello Again and Again) show
grestore
showpage
我相信您对剪切路径的效果的看法是错误的。 如果设置了裁剪路径,它将影响并裁剪后面的所有绘画操作。 IE。所有绘画操作(填充、描边、显示等)仅限于在执行它们时生效的当前剪辑路径内绘画。您可以在该绘画操作后通过调用 grestore 删除剪辑路径,并为下一个绘画操作设置一个新剪辑路径。
/Helvetica 12 selectfont
gsave
<construct the desired clip path with moveto, lineto, whatever>
clip
newpath
20 20 moveto
(Hello!) show % cannot paint outside the current clippath
grestore
% now no clippath is in effect
gsave
<construct the desired clip path somewhere else>
clip
newpath
80 20 moveto
(Hello again!) show
grestore
请注意,与描边或填充等不同,剪辑运算符不会删除当前路径,这就是剪辑运算符几乎总是跟在新路径运算符之后的原因。