如何解决在 PDF 中组合多个剪切路径
是否可以在 PDF 格式本身中组合多个剪辑路径以在 SVG (live demo) 中获得类似的内容:
<svg viewBox="0 0 150 300" preserveAspectRatio="none">
<clipPath id="clip-1" clipPathUnits="userSpaceOnUse">
<rect x="10" y="10" width="24" height="80"></rect>
<ellipse cx="50" cy="50" rx="40" ry="24"></ellipse>
</clipPath>
<clipPath id="clip-2" clipPathUnits="userSpaceOnUse" clip-path="url(#clip-2-top-half)">
<rect x="10" y="110" width="24" height="80"></rect>
<ellipse cx="50" cy="150" rx="40" ry="24"></ellipse>
</clipPath>
<clipPath id="clip-2-top-half" clipPathUnits="userSpaceOnUse">
<rect x="10" y="110" width="80" height="40"></rect>
</clipPath>
<clipPath id="clip-3" clipPathUnits="userSpaceOnUse">
<rect x="10" y="210" width="24" height="80"></rect>
<ellipse cx="50" cy="250" rx="40" ry="24" clip-path="url(#clip-3-top-half)"></ellipse>
</clipPath>
<clipPath id="clip-3-top-half" clipPathUnits="userSpaceOnUse">
<rect x="10" y="210" width="80" height="40"></rect>
</clipPath>
<rect x="10" y="10" width="80" height="80" clip-path="url(#clip-1)" stroke="rgba(255,1)" stroke-width="0.5"
fill="rgba(255,0.25)"></rect>
<text x="10" y="5" font-size="5">1. clip by rect + ellipse</text>
<rect x="10" y="110" width="80" height="80" clip-path="url(#clip-2)" stroke="rgba(255,0.25)"></rect>
<text x="10" y="105" font-size="5">2. clip by rect + ellipse (the both clipped by top-half rect)</text>
<rect x="10" y="210" width="80" height="80" clip-path="url(#clip-3)" stroke="rgba(255,0.25)"></rect>
<text x="10" y="205" font-size="5">3. clip by rect + ellipse clipped by top-half rect</text>
</svg>
第一个剪辑(clip-1
很简单:
q
...rect path commands...
...ellipse path commands...
W
n
...draw...
Q
第二个 (clip-2
) 也很简单:
q
...top-half path commands...
W
n
...rect path commands...
...ellipse path commands...
W
n
...draw...
Q
但第三个需要应用“剪辑到剪辑”。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。