Layer Alpha Preserve¶
Status: proposal
Author: Carsten Hartenfels
Submission data: 25 October, 2023
Implementations: Krita, Drawpile
Several drawing programs support alpha-preserving blend modes on layers, which will blend the color channels as normal, but leave the alpha channel as-is. This is sometimes also called by other names, such as alpha inheritance or clipping groups.
The base OpenRaster specification only allows this for a single case: the
composite-op svg:src-over
has an alpha-preserving variant in the form of
svg:src-atop
.
To include this information for other blend modes, the <layer/>
element in
a layer stack definition should support the following extra attribute:
- “
alpha-preserve
” the alpha preserve status of the layer, expressed as an xsd:boolean. True values (”
true
”, canonically), mean that the layer should be blended without modifying the alpha channel. False values (”false
”, canonically) mean that it should be blended regularly. The default is false.
This attribute must not be used together with the svg:src-over
or
svg:src-atop
composite-ops.
Example¶
<stack>
<layer
name="shading" src="data/layer3.png"
composite-op="svg:multiply"
alpha-preserve="true"/>
<layer
name="recolors" src="data/layer2.png"
composite-op="svg:src-atop"/>
<layer
name="colors" src="data/layer1.png"
composite-op="svg:src-over"/>
</stack>
Impact on Applications¶
Applications that support or require alpha-preserving blend modes should store and load this information accordingly, blending the image as intended. Otherwise, the application should ignore the attribute.
Applications may recognize the incorrect combination of svg:src-over
with
alpha preserve as equivalent to svg:src-atop
.
Applications should disregard the alpha-preserve attribute on svg:src-atop
layers.
The alpha-preserve attribute must be omitted when saving for the archival intent.
Support¶
Implemented in Krita and Drawpile as of 2023-10-21.