w3c / fxtf-drafts

Mirror of https://hg.fxtf.org/drafts
https://drafts.fxtf.org/
Other
69 stars 49 forks source link

[compositing-2] Compositing Operators Lighter and Plus-Darker need some clarifications #454

Open RolandHeinze opened 2 years ago

RolandHeinze commented 2 years ago

The Lighter and Plus-Darker compositing operators of the Compositing and Blending Level 2 specification leave some questions to the reader. The definition of Plus-Darker is even strange and probably wrong. Please clarify the definition of both operators.

  1. The Lighter operator uses the formula αo = αs + αb for the output alpha channel value. That implies that ao can get greater than 1 but how are values geater than 1 handled here? In the Porter & Duff paper Compositing Digital Images, section 4.5 "The Plus Operator" the authors use the dissolve(A, alpha) function which multiplies each color component including the alpha channel value with the alpha value. Furthermore, for image A they use the value alpha and for image B they use the value 1 - alpha as second argument in the dissolve function,. Not until then they apply the Plus operator. Therefore, one would get the formula ao = alpha * as + (1 - alpha) * ab which is always less than or equal to 1. Unfortunately, this constraint of the Plus operator is not part of the Lighter operator in the specification, and as mentioned the value of ao can get greater than 1.
  2. The Plus-darker operator uses the formula αo = max(0, 1 - αs + 1 - αb), which is confusing as 1 - αs + 1 - αb is always geater or equal to 0, and the max() function does not make any sense here. Moreover, the value of 1 - αs + 1 - αb can get greater than 1, and once again there exists no clarification what it means when ao gets greater than 1. Maybe, the formula should be ao = min(1, 1 - αs + 1 - αb) which would make much more sense. Similar, the formula co = max(0, 1 - αs x Cs + 1 - αb x Cb) is confusing, as 1 - αs x Cs + 1 - αb x Cb is always geater than or equal to 0, and the max() function is once again unnecessary. Moreover, I suppose that parenthesis are missing in the formula. Is really 1 - αs x Cs + 1 - αb x Cb meant here, or should it be (1 - αs) x Cs + (1 - αb) x Cb? Maybe, the correct formula is co = min(1, (1 - αs) x Cs + (1 - αb) x Cb). Please, clarify the meaing of the formulas, or correct them.