Re: ISSUE-2095 (soft-light blend mode): Algorithm for soft-light blend mode [Module: Filters]

```Hi All,

--Original Message--:
>ISSUE-2095 (soft-light blend mode): Algorithm for soft-light blend mode [Module: Filters]
>
>http://www.w3.org/Graphics/SVG/WG/track/issues/2095
>
>Raised by: Doug Schepers
>On product: Module: Filters
>
>Benjamin Otte
><http://lists.w3.org/Archives/Public/www-svg/2008Oct/0029.html>:
>[[
>I'm in the process of implementing bend modes in the Cairo imaging
>library[1]. As Cairo is used as the renderer for a wide variety of
>formats, I wanted to have an as comprehensive list of blend modes as
>possible. And it turns out that the blend mode algorithms used are
>almost always equal. However, there is one exception: soft-light. The
>latest SVG draft specifies a different algorithm than PDF.
>
>So I was wondering if it was possible to change the algorithm in SVG
>to match the one of PDF, as that would solve a lot of problems.
>]]

If there is a discrepancy it is a mistake.

While I was working on this, we had to deduce the functions from various
sources, since the equations were not  published. The starting point was
some Japanese site that had reverse engineered the equations from
looking at Photoshop. We extended the base equations to include
alpha correctly.

These were always supposed to be compatible with PDF.

Implementing this showed up bugs in compatibility which were fixed
but probably never made it out to the spec. I believe the correct equations
are:

if 2.Sca < Sa
Dca' = Dca.(Sa + (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa)
otherwise if 8.Dca <= Da
Dca' = Dca.(Sa + (1 - Dca/Da).(2.Sca - Sa).(3 - 8.Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa)
otherwise
Dca' = (Dca.Sa + ((Dca/Da)^(0.5).Da - Dca).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa)

Da'  = Sa + Da - Sa.Da

which is different to what is in the latest published spec. Adobe had an action to
check the equations many years ago which was never acted on. Hopefully the
above equation is what you expected, if not please point us to the references that
are causing issues for you.

Thanks,
Alex
```

Received on Thursday, 9 October 2008 04:31:00 UTC