|
|
Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
|
<feMerge> stacks multiple filter results on top of each other like layers in an image editor, producing a final composite.
It takes zero direct attributes of its own - instead, its child <feMergeNode> elements name the intermediate results to layer. Layers are stacked in document order, bottom to top: the first <feMergeNode> becomes the bottom layer, and each subsequent one is painted over it.
<feMerge> is the "glue" that lets a filter chain produce outputs that combine several intermediate steps. For example, a drop shadow filter needs to paint the shadow and the original graphic in the final result - <feMerge> is what unions those two pieces together.
Every merge is just a stack of source-over composites, so <feMerge> is strictly simpler (and clearer) than writing a chain of <feComposite> primitives by hand.
<feMerge> expects one or more <feMergeNode> children. Each <feMergeNode> has a single attribute in that names the filter result to layer. <feMerge> does nothing on its own - all of its behavior is driven by its children. See <feMergeNode> for the full details of the child element.
A classic drop shadow is built from four primitives: take the source's alpha, blur it, offset it down and to the right, then merge that shadow underneath the original graphic.
What each primitive does:
You can merge more than two layers. This example draws two blurred copies of the source at different radii (a wide soft halo and a tighter sharp one) behind the original, producing a two-tone glow effect.
What each layer contributes:
<feMerge> has no element-specific attributes. Only the standard filter primitive attributes apply (see below).
Inherits standard filter primitive attributes from SVGFilterPrimitiveStandardAttributes (x, y, width, height, result).