“Combine” in FSDL is an attribute that must be present within every <layer> element, as well as every <merge> element. Since “combine” effects <layer> and <merge> elements identically, I’m only going to refer to the <layer> element in this post, for example:
<layer combine='add' resref='photo_r' layerid='photo_l' leapout='vignette' pos='0,0' align='top-left' />
The “combine” attribute determines how the alpha channel (transparent parts) of one layer can effect those of other layers. It can be very useful for getting the most out of a small number of graphic resources.
The four possible values for the “combine” attribute are “add,” “clip,” “cutout” and “inter.”
Let’s look at each one individually.
When the value of a “combine” attribute is “add,” the result is that the alpha channel of its <layer> will have no effect on that of the layers beneath it.
Imagine that we have three layers: a red square, a blue circle and a green circle, and the green circle is on top of the other two:
The “combine” attribute of the green circle has a value of “add,” and its alpha channel (which makes the areas outside of its round shape transparent) has no effect on the other layers.
When the value of a “combine” attribute is “clip,” the result is that the alpha channel of its <layer> will inherit those of the layers beneath it.
So, if in the previous example, the green circle layer had a “combine” attribute of “clip,” it would inherit the transparencies of the other two layers. In other words, it would only be visible in the zones where either of the other two layers are also visible:
You might use this effect, for instance, to put a person in front of a photo such that he or she appears to be cropped within the photo’s boundaries.
When the value of a “combine” attribute is “cutout,” the result is that the alpha channel of the layer in front is subtracted from the alpha of the layer behind.
It’s as if the layer in front were used to cut a hole in the layer behind. The layer in front is invisible, but it also makes the layer behind invisible where its alpha intersects with the layer behind.
So, if the green circle layer in the above examples had a “combine” value of “cutout,” it would be as if the shape of the green circle were “cut out” of the other two layers:
You might use this effect, for instance, to cut a window-shaped hole in a picture of a house. That way the layer that is behind the house looks like it’s inside the house.
When the value of a “combine” attribute is “inter,” the result is that layers below are only visible where they intersect with the visible areas of the top layer.
It’s as if we took the form of the top layer (having a “combine” value of “inter”) and erased everything that did not pass within the boundaries of its shape. The colors in the top layer itself are not visible. Using the same layers as in the examples above and giving the top layer (green circle) a “combine” attribute value of “inter,” we get:
You might use this effect, for instance, to take a shape, like a string of paper dolls, and fill it with a texture (where the texture is the lower layer that shows within the shape of the paper dolls).