-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect summation colors? #2291
Comments
(1 - alpha1) * (1 - alpha2) = (1 - alphaSum) I don't claim to know why less.js does it this way, (1/4 of 1/4 opaque is 1/16 opaque?), but that may be the math behind this. |
Think how transparent it would be with 2 sheets of glass 0.75 opaque. Its |
Yes, we decided to borrow alpha handling from simple-compositing model in this case but this was no more than just a quick fix for #1673 (see also #1676 for the discussion). This model is quite weird in this case, but the problem is that other (simple) opacity handling models would be even more faulty.
Based on what rationale? Technically this arithmetic addition can be thought of as adding two sources of light (I guess it was me who suggested "2 sheets of glass" analogy there but that's was not quite correct: you don't get yellow glass by stacking red and green sheets, but you do get it by combining red and green lights). In that context the alpha channel would represent the light intensity, but then we need to introduce quite deep and breaking changes: consider adding weak red and strong green, e.g. I was planning to come up with more "physically strict" transparency handling for arithm ops too (#1675) but after certain experiments I came to conclusion that this thing becomes just too complex to be included in the core (well, addition and subtraction of two colors are actually quite trivial, but multiplication and division plus non-color operands plus keeping at least partial backward compatibility make this thing grow too bloating). So at some point I thought it's just better to leave everything as is :) Especially because of the lack of use-cases (i.e. "yes, it's nice to have some very strict scientific color arithmetic but there's no point to burden the compiler if nobody uses that math" :) So @nicothin in that sense it would be interesting to hear more details about your use-case... (And btw., in this context I'd probably suggest to consider if one of blending functions could fit your use-case better). |
@lukeapage 2 sheets of glass? ok: http://jsbin.com/yubexi/1/edit (the first color should have no effect) |
@nicothin this behaviour goes inline with that of Photoshop, Inkscape, Gimp and any other image editing program I know. Try overlapping two half-transparent rectangles over a transparent background and see what you get. |
less:
css:
Where did the value of 0.9375?
0.75 expected in the alpha channel.
The text was updated successfully, but these errors were encountered: