W3C home > Mailing lists > Public > www-svg@w3.org > February 2011

Re: SVG masks and luminance calculations

From: Dirk Schulze <vbs85@gmx.de>
Date: Thu, 3 Feb 2011 10:39:39 +0100
Cc: www-svg@w3.org, "Robert Longson" <longsonr@gmail.com>
Message-Id: <FB9DB3EC-B029-4ABB-97DF-AB1406894E58@gmx.de>
To: Erik Dahlstrom <ed@opera.com>

Am 03.02.2011 um 09:37 schrieb Erik Dahlstrom:

> On Thu, 03 Feb 2011 08:22:00 +0100, Robert Longson <longsonr@gmail.com> wrote:
> 
>>> I don't fully understand why masks need this kind of special treatment, if
>>> one wants a linearRGB colorspace why not just use
>>> color-interpolation="linearRGB" explicitly? The color-interpolation
>>> property has an initial value of 'sRGB', and it applies to container
>>> elements (including <mask>). To me this looks like a contradiction in the
>>> spec. For performance reasons I would like to propose that the default
>>> behaviour is changed so that it respects the 'color-interpolation'
>>> property, while maintaining the existing behaviour via
>>> "color-interpolation=linearRGB".
>> 
>> Erik,
>> 
>> Is that what Opera currently implements? If not what is it doing?
> 
> Like I wrote in [1] my current thinking is that the linearRGB luminance calculation for the mask element is in conflict with the 'color-interpolation' property.
> 
> Opera is currently doing the luminance calculation in sRGB-space. According to the mozilla bugreport comments (see link in [1]) that's also what e.g Photoshop does.

Given the fact that there are still bug reports about a wrong behavior on Firefox, it looks like the spec is a bit confusing here. I agree to Eric that linearRGB as default looks a bit confusing since the default of color-interpolation is sRGB. I guess the root of this phrasing is the specification of SVG Filters. The masking text relies to 'feColorMatrix'. And the default color space on filters is linearRGB[1]. 
Both confused me at the time I startet working on implementing masks[2] and filters. But filter has another property named 'color-interpolation-filters'. And the default value is linearRGB for this property. So even if I'm unsure why linearRGB was chosen, the definition looks clear here. This is different on Masking. And it might make sense to use sRGB as default.
The most(unsure about Safari/Win) ports of WebKit use linearRGB as default now, but it's no problem to change it back to sRGB. Note that the masking tests on the test suite would need new results, or the tests need to use  color-interpolation="linearRGB" explicitly.

Cheers,
Dirk

[1] http://www.w3.org/TR/SVG/painting.html#ColorInterpolationFiltersProperty
[2] http://lists.w3.org/Archives/Public/www-svg/2009Feb/0016.html
Received on Thursday, 3 February 2011 09:40:15 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:47 GMT