有没有办法在SVG中应用9-patch / scale-9原则? [英] Is there a way to apply 9-patch / scale-9 principles in SVG?

查看:103
本文介绍了有没有办法在SVG中应用9-patch / scale-9原则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法制作一个svg图形,可以根据与 9-patch (或闪存中的9级补丁)。

I'm wondering if there is a way to make an svg graphic that would scale accordingly to the same principle as 9-patch on Android (or like scale 9 in flash).

基本上,svg内部的部分内容应该扩展相应于视口的正常扩展规则,但某些元素将保持未缩放和锚定,如svg文件中所定义。

Basically, part of the content inside the svg should scale accordingly to the normal expansion rules of the viewport but certain elements would remain unscaled and anchored as defined in the svg file.

(这个想法是为了制作一些复杂的背景一些按钮使用SVG,但允许它们按钮的内部内容进行相应缩放)

(The idea would be to make some complicated background for some buttons using SVG but allowing them to scale accordingly with the inner content of the button)

我不认为使用普通的svg声明是可能的,但也许有点嵌入式脚本编写,虽然我找不到任何示例或库这样做..

I don't think it's possible with plain svg declarations, but maybe with a bit of embedded scripting, though I couldn't find any example or library doing this..

**编辑:**我知道今年的SO问题但我很高兴选择某人可能有一个替代的,更可重复使用的选项/库

** ** I'm aware of this year old SO question but I'm hoping someone may have an alternative, more reusable option / library

推荐答案

我在我的博客上写过它,它可能在一个当你愿意牺牲IE以及在IE中运行的几乎方式以及你可以忍受一个不那么完美的解决方案的时候,完美的方式: http://w3.eleqtriq.com/2014/03/the-holy-grail-of-image-scaling/

I wrote about it on my blog, it's possible in a "perfect" way when you are willing to sacrifice IE and an "almost" way that works in IE as well as long as you can live with a not so perfect solution: http://w3.eleqtriq.com/2014/03/the-holy-grail-of-image-scaling/

这篇关于有没有办法在SVG中应用9-patch / scale-9原则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆