共用方式為


SVG 支援

從 Windows 10 年度更新版開始,Direct2D 支援轉譯 色彩字型, 包含 SVG 字元外框,如 OpenType 規格 中所述(請參閱 SVG 表格中所述。 從 Windows 10 Creators Update 開始,Direct2D 也支持轉譯獨立 SVG 影像。 不過,OpenType SVG 字型中不允許某些 SVG 功能,Direct2D 目前不支援某些 SVG 功能。  

本主題會識別 Windows 10 年度更新版中 Direct2D 支援的一組 SVG 1.1 功能。 本文件適用於 OpenType 字型中的 SVG,以及獨立 SVG 影像。

支援的 SVG 元素和屬性

Direct2D 支援轉譯下列 SVG 元素,以及每個元素的相關屬性。 忽略其他元素和一般屬性。

元素 支援的一般屬性
圓形 id, style, transform, cx, cy, r
clipPath id, style, transform, clipPathUnits
defs id, style, transform
desc* id
省略號 id, style, transform, cx, cy, rx, ry
g id, style, transform
映像 id, style, transform, x, y, width, height, preserveAspectRatio, xlink:href
id, style, transform, x1, y1, x2, y2
linearGradient id, style, x1, y1, x2, y2, gradientUnits, gradientTransform, spreadMethod, xlink:href
路徑 id, style, transform, d
多邊形 id, style, transform, points
聚合線條 id, style, transform, points
radialGradient id, style, cx, cy, r, fx, fy, gradientUnits, gradientTransform, spreadMethod, xlink:href
整治 id, style, transform, x, y, width, height, rx, ry
停止 id、style、offset
svg id, style, x, y, width, height, viewBox, preserveAspectRatio
標題* id
使用 id, style, transform, x, y, width, height, xlink:href

 

* 僅支援 Windows 10 Creators Update 和更新版本

支援的 SVG 簡報屬性

Direct2D 也支援下列簡報屬性。 這些可以在任何 SVG 元素上指定,但只會影響 SVG 規格中所述的特定元素外觀(請參閱 Presentation 屬性)。

  • clip-path
  • clip-rule
  • 顏色
  • display*
  • 填補
  • fill-opacity
  • fill-rule
  • 不透明度
  • 溢出
  • stop-color
  • stop-opacity
  • 中風
  • stroke-dasharray
  • stroke-dashoffset
  • stroke-linecap
  • stroke-linejoin
  • stroke-miterlimit
  • stroke-opacity
  • stroke-width
  • visibility*

* 僅支援 Windows 10 Creators Update 和更新版本

不支援的SVG功能

不支援的項目和屬性

上述清單中未包含的任何元素或屬性,都會被視為 Direct2D 不支援。 剖析包含不支援元素或屬性的 SVG 內容時,會忽略不支援的實體。 其餘的內容會盡可能忠實地轉譯。

不支援的長度單位

自 Windows 10 年度更新版起,Direct2D 僅支援用戶空間長度值和百分比長度值。 不支援具有單位後綴的長度,例如 「mm」 或 「em」。

從 Windows 10 Fall Creators Update 開始,Direct2D 也支持絕對單位標識碼:px、pt、pc、cm、mm 和 in。 不支援相對單位識別碼 (em, ex) 。

不支援的映像來源

只有當影像元素的 xlink:href 屬性設定為base64編碼的影像時,才支援該影像。 不支援遠程參考。