2

我可以创建一个包含填充的 SVG 路径的 SVG 图像,正如这个问题中已经提到的:Fill SVG path element with a background-image

SVG 看起来像这样:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" version="1.1">
    <g transform="translate(0, 0) rotate(0)" opacity="1">
        <defs>
            <pattern id="img_patrickComp_patrick_cv1_Graphic3" height="313" width="468"  patternTransform="translate(0, 0) scale(1, 1) rotate(0)" patternUnits="userSpaceOnUse">
                <image x="0" y="0" opacity="1" height="313" width="468" xlink:href="http://www.bittbox.com/wp-content/uploads/2008/04/free_hires_wood_texture_5.jpg" />
            </pattern>
        </defs>
        <path fill="url(#img_patrickComp_patrick_cv1_Graphic3)" stroke="Blue" d="M 86,100L 298,394L 289,710L 100,610L 100,400L 46,400 z" />
    </g>
</svg>

(SVG 链接:http: //jsfiddle.net/2UFtV/

是否可以在不知道图像宽度和高度的情况下创建相同的纹理 SVG?

4

1 回答 1

2

If you want to preserve the raster image at it's native dimensions you need to know the dimensions yes.

于 2012-05-22T08:08:24.420 回答