# Re: painting-render-02-b.svg

From: Dirk Schulze <vbs85@gmx.de>
Date: Wed, 9 Feb 2011 20:58:01 +0100

Message-Id: <E685C501-FB76-4676-9E69-465BFB9BFD60@gmx.de>
To: Osmo Jaakkola <orbik@iki.fi>
```
Am 09.02.2011 um 17:51 schrieb Osmo Jaakkola:

>> All white rects have the same transparency level and are drawn onto asolid black background. Just the rects on the first row are filled witheither #7F7F7F or #BBBBBB but don't test color-interpolationat all.
>>> Yes. On both the source and the background.
>> Ok, this is maybe the point where I have the understanding problems. Istill read the Spec this way: At first we have the canvas, whereeverything is drawn on by the compositing algorithm mentioned on thelink you posted.
>> Now we want to draw a shape onto this canvas in the color spacelinearRGB while the canvas itself is in sRGB.
>> For a better understanding I'll take a surface/buffer where I draw theshape onto. This surface with the shape gets transformed to linearRGB.Now I draw this surface on the canvas by compositing it with thealgorithm of the spec respecting the transparence that is set by theproperty 'fill-opacity'.
>> For the example on the test suite, it means we would draw the rect ontothe canvas with the fill color white. Now we transform this surface tolinearRGB. But because we filled the shape with white: rgb(255,255,255)the linearRGB transformation doesn't influence the surface. According tothe sRGB to linearRGB algorithm of the Spec, the resulting color valuesare rgb(255,255,255).
>> At the end we draw the surface on the canvas with the 'fill-opcity:0.5'by compositing it to the canvas.
>> The background is black, so we see the same gray independent if we drawthe rect with linearRGB or sRGB.
>> We might of course see a difference if we'd use another fill color thanwhite. But I don't get it why we should see a difference on this test.
>
> Because the alpha blending is done in linear RGB, and needs to be converted back to the parent's (canvas') color space.
>
> Background = sRGB(0, 0, 0) => linRGB(0, 0, 0)
> Foreground = sRGB(1.0, 1.0, 1.0) => linRGB(1.0, 1.0, 1.0)
> Opacity = 0.5
> Result = linRGB(0.5, 0.5, 0.5) => sRGB(0.735, 0.735, 0.735)

That would mean, we draw the content to the canvas ad transform the relevant parts afterwards to linearRGB ?!?

If I take your example. I'd see it like this:

Background = sRGB(0, 0, 0) => linRGB(0, 0, 0)
Foreground = linearRGB(1.0, 1.0, 1.0) => sRGB(1.0, 1.0, 1.0)
Opacity = 0.5
Result = sRGB(0.5, 0.5, 0.5)

The color space of the shape with color-interpolation="linearRGB" should be transformed, not the canvas after the compositing operation. Of course I could be wrong. It's just not clear to me, why we should transform the resulting image instead of your foreground.

Cheers
Dirk
```
Received on Wednesday, 9 February 2011 19:58:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:24 UTC