XML technologies / SVG / Filters, transformations and gradients / Using and combining filters and lighting effectively / Filters and masks / The feDisplacementMap filter element

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

This filter element manipulates two images by moving pixels from the first into the second, according to this formula:

P'(x,y) <- P(x + scale * ((XC(x,y) - .5), y + scale * (YC(x,y) - .5))

Here, P'(x,y) represents the calculated pixel at x/y; P(x,y) is the pixel of the image specified with in. Set the values XC and YC using the attributes xChannelSelector and yChannelSelector. In addition to the universal attributes, the filter element has these attributes:

<filter id="scale10Rot">
  <feOffset dx="0" dy="0" in="SourceGraphic" result="rText"/>
  <feDisplacementMap in="SourceGraphic" in2="rText" scale="10" xChannelSelector="R" yChannelSelector="R"/>
</filter>
<filter id="scale10Alpha">
  <feOffset dx="0" dy="0" in="SourceAlpha" result="rText"/>
  <feDisplacementMap in="SourceGraphic" in2="rText" scale="10" xChannelSelector="A" yChannelSelector="A"/>
</filter>

Results of the defined feDisplacementMap filters

Figure: Results of the defined feDisplacementMap filters.

   

 

 

 

back to top