Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

SVG Preview (Scaled)

Preview of https://hg.mozilla.org/mozilla-central/raw-file/tip/layout/reftests/svg/filters/feComposite-1.svg
<filter id="f1" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
x="0" y="0" width="1" height="1">
<feFlood flood-color="#ff0000" flood-opacity="0.5" result="flood"/>
<feComposite x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
in="flood" operator="over" in2="SourceGraphic"/>
</filter>
<g filter="url(#f1)">
<rect x="0" y="0" width="50" height="100" fill="#00ff00"/>
<rect x="50" y="0" width="50" height="100" fill="#00ff00" opacity="0"/>
</g>
<filter id="f2" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
x="0" y="0" width="1" height="1">
<feFlood flood-color="#ff0000" result="flood"/>
<feComposite x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
in="flood" operator="in" in2="SourceGraphic"/>
</filter>
<g filter="url(#f2)">
<rect x="100" y="0" width="50" height="100" fill="#00ff00"/>
<rect x="150" y="0" width="50" height="100" fill="#00ff00" opacity="0"/>
</g>
<filter id="f3" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
x="0" y="0" width="1" height="1">
<feFlood flood-color="#ff0000" result="flood"/>
<feComposite x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
in="flood" operator="out" in2="SourceGraphic"/>
</filter>
<g filter="url(#f3)">
<rect x="200" y="0" width="50" height="100" fill="#00ff00"/>
<rect x="250" y="0" width="50" height="100" fill="#00ff00" opacity="0"/>
</g>
<filter id="f4" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
x="0" y="0" width="1" height="1">
<feFlood flood-color="#ff0000" flood-opacity="0.5" result="flood"/>
<feComposite x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
in="flood" operator="atop" in2="SourceGraphic"/>
</filter>
<g filter="url(#f4)">
<rect x="300" y="0" width="50" height="100" fill="#00ff00"/>
<rect x="350" y="0" width="50" height="100" fill="#00ff00" opacity="0"/>
</g>
<filter id="f5" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
x="0" y="0" width="1" height="1">
<feFlood flood-color="#ff0000" result="flood"/>
<feComposite x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
in="flood" operator="xor" in2="SourceGraphic"/>
</filter>
<g filter="url(#f5)">
<rect x="400" y="0" width="50" height="100" fill="#00ff00"/>
<rect x="450" y="0" width="50" height="100" fill="#00ff00" opacity="0"/>
</g>
<filter id="f6" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
x="0" y="0" width="1" height="1">
<feFlood flood-color="#ff0000" result="flood"/>
<feComposite x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
in="flood" operator="arithmetic" in2="SourceGraphic"
k2="1" k3="1"/>
</filter>
<g filter="url(#f6)">
<rect x="500" y="0" width="50" height="100" fill="#00ff00"/>
<rect x="550" y="0" width="50" height="100" fill="#00ff00" opacity="0"/>
</g>
<!-- Test the tricky case where the arithmetic operator leads to drawing outside
the bounding box of the source images -->
<filter id="f7" filterUnits="userSpaceOnUse" primitiveUnits="userSpaceOnUse"
x="0" y="100" width="100" height="100">
<feComposite x="10" y="110" width="80" height="80" style="color-interpolation-filters:sRGB"
in="SourceGraphic" operator="arithmetic" in2="SourceGraphic"
k4="1"/>
</filter>
<rect x="0" y="100" width="100" height="100" fill="#000000"/>
<g filter="url(#f7)">
</g>
</svg>