SVG 1.1:什么是“用户单元"?以及如何将用户单位转换成绝对单位(例如:毫米)? [英] SVG 1.1 : What is "user unit" and how to convert user unit into absolute unit(eg: millimeter)?

查看:331
本文介绍了SVG 1.1:什么是“用户单元"?以及如何将用户单位转换成绝对单位(例如:毫米)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现SVG Tiny 1.1,并且在理解用户单元"概念时遇到了麻烦.

I am implementing SVG Tiny 1.1 and I am having trouble understanding the "user unit" concept.

SVG 1.1规范定义了每个,其中没有指定单位(例如"mm","cm","pt"等)位于用户单位"中.

SVG 1.1 specification defines every <length> with no specified unit (such as "mm", "cm", "pt", etc) to be in "user unit".

在实现接口"SVGLength"时,我遇到了4个与长度值有关的属性; valueunityTypevalueInSpecifiedUnitvalueAsString.最后3个属性对我来说足够清楚.

While implementing interface "SVGLength", I encountered 4 attributes related to the value of the length; value, unityType, valueInSpecifiedUnit, valueAsString. The last 3 attributes are clear enough for me.

  1. valueInSpecifiedUnit的单位类型为unitType.
  2. valueAsString等于valueInSpecifiedUnit + unitType的字符串值.例如:"10mm"
  1. valueInSpecifiedUnit is in unit type unitType.
  2. valueAsString equals valueInSpecifiedUnit+unitType's string value. Eg: "10mm"

但是,据说属性 value 位于用户单位中.所以我的问题是:

However, the attribute value is said to be in user unit. So my questions are:

  1. 什么是用户单位"?
  2. 如何从用户单位"转换为绝对单位",例如毫米(mm)?

此致

推荐答案

规范:

用户单位

以用户单位表示的坐标值或长度 代表当前用户坐标中的坐标值或长度 系统.因此,10个用户单位代表10个用户单位的长度 当前的用户坐标系.

A coordinate value or length expressed in user units represents a coordinate value or length in the current user coordinate system. Thus, 10 user units represents a length of 10 units in the current user coordinate system.

也:

如果最外面的svg元素上的宽度"或高度"属性以用户单位为单位 (即未提供单位标识符),则该值被认为是等效的 相同数量的"px"单位

if the ‘width’ or ‘height’ attributes on the outermost svg element are in user units (i.e., no unit identifier has been provided), then the value is assumed to be equivalent to the same number of "px" units

这意味着用户单位是在最外层svg元素的width和height属性中指定的单位,如果未指定,则用户单位为像素.

which means that user units are the units specified in the outermost svg element's width and height attributes, and if they are not specified, then user units are pixels.

阅读有关SVG中的单元的部分.

这篇关于SVG 1.1:什么是“用户单元"?以及如何将用户单位转换成绝对单位(例如:毫米)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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