Skip to content

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

Closed
@seven-phases-max

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.

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