Skip to content
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

Make 'color-interpolation' work in associated alpha #303

Open
leni536 opened this issue Jan 24, 2017 · 3 comments
Open

Make 'color-interpolation' work in associated alpha #303

leni536 opened this issue Jan 24, 2017 · 3 comments

Comments

@leni536
Copy link

leni536 commented Jan 24, 2017

https://www.w3.org/TR/2016/CR-SVG2-20160915/painting.html#ColorInterpolation

It says: "Having chosen the appropriate color space, component-wise linear interpolation is used." The available color spaces are linearRGB and sRGB.

Interpolating colors with non-1 opacity should use associated alpha for interpolation, or at least there should be an option for using associated alpha (like offering linearRGBaa as an option).

Why should color interpolation work like this? This way the two operations of blending the colors with a solid color background and applying the interpolation are interchangeable. Imagine a gradient between fully opque red and fully transparent "blue" on a white background. According to the current standard in the middle we get light purple. With associated alpha we exactly get a gradient between red and white.

@nikosandronikos
Copy link
Member

nikosandronikos commented Jan 24, 2017

(Edited because my first reply was just wrong - haven't thought about this a while and I was getting confused with something else).
This is the way SVG is intended to work. You get blue because the colour is transitioning to blue as the alpha is transitioning to transparent. The author has specified a colour, so that colour has some significance. If you want to transition red to transparent red, then specify those colours.
Agree this is different to CSS. Have a look at issue #180 for the back story.

@leni536
Copy link
Author

leni536 commented Jan 25, 2017

Ok, I see that #180 addresses this for gradients, but note that color-interpolation is also used for filter effects too (among other stuff). I can also see that this can be a desired effect, also I can see gradients in premultiplied/associated alpha can be a desired effect too, so having both couldn't hurt.

Now imagine if I include a transparent png in my svg, put it on a light background and apply gaussian blur on it. If the png file's transparent parts are "black", then the image at the edges of opaque regions gets black leaked in and looks "dirty". I might not want that. I also might not want to blend with the background before and then applying the gaussian blur because I might not want to blur the background too.

@boggydigital boggydigital added this to the SVG 2.1 Working Draft milestone Jun 11, 2018
@boggydigital
Copy link
Contributor

Not blocking updated 2.0 CR publication - assigning 2.1 WD milestone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants