[PATCH v2 4/5] gdiplus: Fix hatch brush patterns that require anti-aliasing.

Jeff Smith whydoubt at gmail.com
Sun Jun 14 02:16:15 CDT 2020


On Sat, Jun 13, 2020 at 11:46 PM Esme Povirk (they/them)
<vincent at codeweavers.com> wrote:
>
> On Sat, Jun 13, 2020 at 11:11 PM Jeff Smith <whydoubt at gmail.com> wrote:
> > While hatch brush colors are specified as ARGB, for the purpose of
> > anti-aliasing, they are blended as PARGB. This is effectively the same
> > for opaque hatch colors. For transparent hatch colors, alpha will be
> > correct, but rgb components will be off to some degree.

Let me break this out further so maybe we can get on the
same page.  Hopefully this doesn't get completely butchered...

The best-case-scenario for compositing ARGB is this:

      [forecolor ARGB] ---> {premult} -----> [forecolor PARGB]
                                                         |
  [result ARGB] <-- {premult^-1} <-- [result PARGB] <-- {blend}
                                                          |
      [backcolor ARGB] ---> {premult} -----> [backcolor PARGB]

The {blend} function interpolates each channel independently.
The {premult^-1} function is the inverse of {premult}.

For this patch I am focused on getting the RGB subset (i.e. A = 255)
right, which makes {premult} a no-op and simplifies to

       [forecolor RGB]
                   |
[result RGB] <-- {blend}
                   |
       [backcolor RGB]

The {blend} function is the same though (except that strictly
speaking it also simplifies the result A to a constant 255).

Except for not hardcoding A = 255, this is what this patch does.
For this RGB subset, I have tested extensively and it matches
results from native gdiplus perfectly AFAICT.

> Why not blend them as ARGB?

What are you suggesting that is not being done now?



More information about the wine-devel mailing list