The <feComposite>
SVG filter primitive performs the combination of two input images pixel-wise in image space using one of the Porter-Duff compositing operations: over
, in
, atop
, out
, xor
, lighter
, or arithmetic
.
The table below shows each of these operations using an image of the MDN logo composited with a red circle:
Operation | Description |
---|---|
over | The source graphic defined by the in attribute (the MDN logo) is placed over the destination graphic defined by the in2 attribute (the circle). This is the default operation, which will be used if no operation or an unsupported operation is specified. |
in | The parts of the source graphic defined by the in attribute that overlap the destination graphic defined in the in2 attribute, replace the destination graphic. |
out | The parts of the source graphic defined by the in attribute that fall outside the destination graphic defined in the in2 attribute, are displayed. |
atop | The parts of the source graphic defined in the in attribute, which overlap the destination graphic defined in the in2 attribute, replace the destination graphic. The parts of the destination graphic that do not overlap with the source graphic stay untouched. |
xor | The non-overlapping regions of the source graphic defined in the in attribute and the destination graphic defined in the in2 attribute are combined. |
lighter | The sum of the source graphic defined in the in attribute and the destination graphic defined in the in2 attribute is displayed. |
arithmetic | The result = k1*i1*i2 + k2*i1 + k3*i2 + k4 where: |