<feImage>

Baseline 廣泛可用 *

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2015 年 7 月⁩以來,各瀏覽器均已提供此特性。

* 此特性的某些部分可能存在不同級別的支援。

<feImage> SVG 濾鏡基元從外部源獲取影像資料,並提供畫素資料作為輸出(這意味著如果外部源是 SVG 影像,它將被柵格化)。

使用語境

分類濾鏡圖元元素
允許內容可包含任意數量、任意順序的下列元素
<animate>, <animateTransform>, <discard>, <set>

屬性

DOM 介面

此元素實現了 SVGFEImageElement 介面。

示例

SVG

html
<svg
  viewBox="0 0 200 200"
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  width="200"
  height="200">
  <defs>
    <filter id="image">
      <feImage href="mdn_logo_only_color.png" />
    </filter>
  </defs>

  <rect x="10%" y="10%" width="80%" height="80%" filter="url(#image)" />
</svg>

結果

規範

規範
濾鏡效果模組第 1 級
# feImageElement

瀏覽器相容性

另見