gpt4 book ai didi

SVG 1.1 : What is "user unit" and how to convert user unit into absolute unit(eg: millimeter)?

转载 作者:行者123 更新时间:2023-12-04 11:43:23 27 4
gpt4 key购买 nike

我正在实现 SVG Tiny 1.1,但我无法理解“用户单元”的概念。

SVG 1.1 规范将每个没有指定单位(例如“mm”、“cm”、“pt”等)的 定义为“用户单位”。

在实现接口(interface)“SVGLength”时,遇到了4个与长度值相关的属性; value , unityType , valueInSpecifiedUnit , valueAsString .最后三个属性对我来说已经足够清楚了。

  • valueInSpecifiedUnit属于单位类型unitType .
  • valueAsString等于 valueInSpecifiedUnit + unitType的字符串值。例如:“10mm”

  • 但是,属性值被称为以用户为单位。所以我的问题是:
  • 什么是“用户单位”?
  • 如何从“用户单位”转换为“绝对单位”,例如毫米 (mm)?

  • 问候,

    最佳答案

    规范 says :

    user units

    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.



    还:

    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 元素的宽度和高度属性中指定的单位,如果没有指定,则用户单位是像素。

    Read the section on units in SVG .

    关于SVG 1.1 : What is "user unit" and how to convert user unit into absolute unit(eg: millimeter)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7087586/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com