问题描述
我正在尝试在VML中创建一个与SVG中的clip-path
相对应的剪贴蒙版?有可能吗?
I am trying to create a clipping mask in VML that would correspond to clip-path
in SVG? Is that possible?
基于众多但相当有限的示例,我尝试绘制形状:
Based on numerous, but fairly limited, examples I have tried drawing the shape:
<vml:group style="WIDTH: 1px; HEIGHT: 1px" class=vml-element coordsize = "1,1">
<vml:shape style="WIDTH: 1px; HEIGHT: 1px" id=vectorObject2 class=vml-element _fill-color="red" _fill-opacity="1" _stroke-color="black" _stroke-opacity="1" _stroke-width="1" coordsize = "1,1" filled = "t" fillcolor = "red" stroked = "t" strokecolor = "black" strokeweight = ".75pt" path = "m0,0 l100,0,0,100 xe">
<vml:fill class=vml-element opacity = "1"></vml:fill>
<vml:stroke class=vml-element opacity = "1"></vml:stroke>
</vml:shape>
</vml:group>
,然后使用vmlframe
屏蔽它:
<vml:vmlframe class=vml-element clip = "t" size = "15pt,37.5pt" src = "#vectorObject2"> </vml:vmlframe>
形状(三角形)的图形可以按预期工作,但是我找不到使用 vmlframe 对其进行遮罩的方法.那是实现遮罩的正确方法吗?
Drawing of shape (triangle) works as expected but I cannot find I way to mask it using vmlframe. Is that the right way to achieve masking?
请忽略所有奇怪的自定义属性,因为大多数VML代码是通过第3方库生成的.
Please ignore all bunch of weird custom attributes as majority of VML code was generated via 3rd party library.
提前谢谢!
推荐答案
使用 CSS剪辑属性,以模拟剪辑路径,如 Dojo GFX库中所示或类似 jsgraphics 之类的东西.
Use the CSS clip property to emulate clip-path as demonstrated in the Dojo GFX library or something like jsgraphics.
这篇关于vml剪贴蒙版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!