此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

feComposite

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2018年10月⁩.

该滤镜执行两个输入图像的智能像素组合,在图像空间中使用以下 Porter-Duff 合成操作之一:over、in、atop、xor。另外,还可以应用一个智能组件arithmetic 操作(结果被压到 [0,1] 范围内)。

该 arithmetic 操作对组合来自<feDiffuseLighting>滤镜和来自<feSpecularLighting> 滤镜的输出以及组合纹理数据很有用。如果选择了arithmetic操作,每个结果像素都要经过下面的方程式的计算:

result = k1*i1*i2 + k2*i1 + k3*i2 + k4

在这里:

  • i1i2 标`示了输入图像相应的像素通道值,分别映射到inin2
  • k1k2k3k4 标示了同名的属性值。