Skip to content

Better transparency handling with math ops and blending functions? #1675

Closed

Description

@seven-phases-max

I was playing with #1673 issue, specifically thinking of more reasonable alpha calculation and found that things go a bit wider than just a proper alpha op. Beside math ops, there are also color blending functions that totally ignore alpha channels and always return non-transparent colors (so blending functions don't suffer from #1673 :).
E.g.:

color: average(rgba(255, 0, 0, .5), rgba(0, 0, 255, .5)); // -> #800080

Probably a transparency handling similar to http://www.w3.org/TR/compositing-1/#blending would make more sense. And it looks like this should somehow apply to math ops as well.

Additionally it seems that ideally tree.Color op tree.Dimension and tree.Color op tree.Color where op is * or / operations should be handled in different ways, e.g.:

mul {
    a: (#800000 * 2);       // -> #ff0000, OK
    b: (#100000 * #100000); // -> #ff0000, i.e. ~black * ~black = red :)
                            // could it be blending `multiply` instead?
}

Of course all this will need a lot of code changes so that "demand/efforts ratio" becomes questionable, but I just wanted to have some food for thought.

Activity

  1. seven-phases-max commented on Sep 3, 2014

    @seven-phases-max
    MemberAuthor

    So transparency for blending functions is implemented with #1704. And as for transparency of math ops I guess I abandon/postpone this idea since it does not seems like possible use-cases are worth an efforts needed and an additional complier burden (Though the research for possible algorithms was quite inspirational on its own :)

  2. removed their assignment
    on Sep 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions