Skip to content

Alternative compositing methods #6210

Closed

Description

@wavexx

I'm wondering if there is general interest in having other alpha/color compositing modes for filling edges and patches in MPL. I'd love to have all the classical Porter/Duff operators.

I find alpha blending very limiting. If I want to overlay two datasets while preserving decent luminosity in the output, there are very few light colors that work well and retain good contrast. HSL color blending would in almost all cases provide better results.

If I want to highlight the intersection between two areas, alpha blending incurs into the same problem. I need to calculate the intersection myself for good results. With simple XORing I wouldn't have to.

At least with the cairo backend, it shouldn't be hard to implement, as it has native support for all the classical compositing operators (http://cairographics.org/operators/). I cannot comment on other backends. The blending operator would need to be an extra property of both patches and edges, although for proper compositing you might (as the user) need to separate rasterization of the two for proper results.

General comments?

Activity

  1. added this to the milestone on Mar 23, 2016
  2. mdboom commented on Mar 23, 2016

    @mdboom
    Member

    I'm 👍 on the idea. The Agg backend will probably be the trickiest. The Agg library supports these operations, but we have not exposed them to Python, and being templatized C++, it could require a lot of template instantiations to get working.

    Postscript as a format doesn't support these, but it's fine to ignore it for a new feature like this.

  3. anntzer commented on May 12, 2018

    @anntzer
    Contributor

    fwiw, now implemented by mplcairo (https://github.com/anntzer/mplcairo/blob/master/examples/operators.py), though of course this needs to be manually set by a custom artist subclass as there is no support from mpl's side.

    Edit: mplcairo can now dynamically generate such artist subclasses.

  4. modified the milestones: , needs sorting on Oct 6, 2022
  5. github-actions commented on May 27, 2024

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  6. added
    keepItems to be ignored by the “Stale” Github Action
    and removed
    status: inactiveMarked by the “Stale” Github Action
    on May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesNew featurekeepItems to be ignored by the “Stale” Github Actiontopic: color/alpha

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions