xChannelSelector - SVG: Scalable Vector Graphics 编辑

The xChannelSelector attribute indicates which color channel from in2 to use to displace the pixels in in along the x-axis.

Only one element is using this attribute: <feDisplacementMap>

html, body, svg {
  height: 100%;
}
<svg viewBox="0 0 440 160" xmlns="http://www.w3.org/2000/svg">
  <filter id="displacementFilter">
    <feImage xlink:href="https://mdn.mozillademos.org/files/12668/MDN.svg"
        x="0" y="0" width="100%" height="100%" result="abc"/>
    <feDisplacementMap in2="abc" in="SourceGraphic"
        scale="30" xChannelSelector="R"/>
  </filter>
  <filter id="displacementFilter2">
    <feImage xlink:href="https://mdn.mozillademos.org/files/12668/MDN.svg"
        x="0" y="0" width="100%" height="100%" result="abc"/>
    <feDisplacementMap in2="abc" in="SourceGraphic"
        scale="30" xChannelSelector="B"/>
  </filter>

  <text x="10" y="60" font-size="50"
      filter="url(#displacementFilter)">Some displaced text</text>
  <text x="10" y="120" font-size="50"
      filter="url(#displacementFilter2)">Some displaced text</text>
</svg>

Usage notes

ValueR | G | B | A
Default valueA
AnimatableYes
R
This keyword specifies that the red color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis.
G
This keyword specifies that the green color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis.
B
This keyword specifies that the blue color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis.
A
This keyword specifies that the alpha channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis.

Specifications

SpecificationStatusComment
Filter Effects Module Level 1
The definition of 'xChannelSelector' in that specification.
Working DraftNo change
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'xChannelSelector' in that specification.
RecommendationInitial definition

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:129 次

字数:5013

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文