SVG:拉伸图像 [英] SVG: stretching an image
本文介绍了SVG:拉伸图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在玩SVG教程,我只是加载了这样的图像:
I'm playing around with the SVG tutorial and I simply loaded an image like this:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg style="stroke-linejoin:round; stroke:black; stroke-width:0.5pt; text-anchor:middle; fill:none" xmlns="http://www.w3.org/2000/svg" font-family="Helvetica, Arial, FreeSans, Sans, sans, sans-serif" height="400px" width="400px" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 250 250">
<rect y="0" x="0" height="250" width="250" stroke="black" stroke-width="1" fill="blue" />
<image y="0" x="0" height="250" width="250" xlink:href="http://www.blueprintmodel.co.uk/images/DSCF1438.jpg" />
</svg>
即使高度和宽度相同,我在viewBox的中心,rect上方获取图像。
我的问题是:
I get image in the center of viewBox, over "rect", even if height and width are same. My questions are:
- 如何将图像拉伸为矩形尺寸?
- 为什么image标签中的height不起作用?
- 我可以使用拉伸或调整大小这样的转换吗?(我无法'找到它们)
推荐答案
设置 preserveAspectRatio =none。
这篇关于SVG:拉伸图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文