[fxtf-drafts] [compositing-2] Add support for add, subtract and divide blending modes. (#449)

VodBox has just created a new issue for https://github.com/w3c/fxtf-drafts:

== [compositing-2] Add support for add, subtract and divide blending modes. ==
I propose adding to the Compositing and Blending spec, to include "add"/"linear-dodge", "subtract" and "divide" as additional separable blending modes.

Add, subtract and divide are all common blending modes that a designer would be familiar with from most image editing or compositing software, and their results cannot easily or exactly be replicated through the use of the existing blending modes defined in the spec.

Add is very useful for certain kinds of effects like with things that glow, since while the screen blending mode might be closer to how physical light would combine if being projected, it can appear to lack saturation and not look correct for things like neon or very bright objects that exist in front of a surface, rather than being projected. A designer may also just prefer the look of add over screen, even if it's not accurate to how light would actually behave.

Subtract and divide, while their use cases are significantly less common, are typically also seen as options in editors alongside add, and including them means that designers who expect those blending modes to be there will see support from browsers.

The proposed blending modes would be added to the separable blending modes section of the spec, and use the following definitions:

Add:
B(Cb, Cs) = min(1, Cb + Cs)

Subtract:
B(Cb, Cs) = max(0, Cb - Cs)

Divide:
if (Cs == 0)
    B(Cb, Cs) = 1
else
    B(Cb, Cs) = min(1, Cb / Cs)

Note, that plus-lighter and plus-darker, while they also perform addition and subtraction on the color components respectively like these proposed blending modes, they also perform addition and subtraction on the alpha component, which is not desirable with a true add and subtract blending mode. Moreover, add and subtract as blending modes should be expected to work with the other standard compositing operations, such as source-over.

Relevant part of the spec: [https://drafts.fxtf.org/compositing/#blendingseparable](https://drafts.fxtf.org/compositing/#blendingseparable)



Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/449 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 3 February 2022 07:51:13 UTC