SVG Masks are changing their default colour space

According to the original SVG 1.1 specification masks in SVG always operated in the linear RGB colour space. That meant that Firefox always converted the graphic being masked to linear RGB and after that, applied the mask.

SVG 1.1 2nd edition changes the way masks work and a patch has landed for Firefox 10 to match that change. SVG masks now honour the color-interpolation property. This means that authors can choose whether the graphic is converted to linear RGB before the mask is applied.

The thing to watch out for though is that the default value for color-interpolation is sRGB so existing content may render slightly differently. If you want things to stay the same you need to add color-interpolation=”linearRGB” as an attribute of the mask element.

Opera has worked like this for some time now and a patch make this change also landed in Webkit recently so Chrome and Safari will render things this way at some point too.


3 responses to this post.

  1. Got a bug number on this? I need to be sure to track it for docs.

  2. I am trying to work out what exactly is linearRGB. I know a little of sRGB colorspace and premultiplied and un-premultiplied space with my experiments with CSS3 gradients and SVGs. A recent question on www-style was if box-shadow was done in linearRGB or sRGB (Firefox seems to be alone in it’s rendering).

    Reading the bug report still doesn’t help. Maybe I should learn graphics and maths at university. Hand coding SVG is fine but it does not help if a UA is implementing the code of a SVG wrong.

Comments are closed.

%d bloggers like this: