W3C home > Mailing lists > Public > www-style@w3.org > August 2010

Re: CSS3 Color: Interaction of opacity and rgba [css3-color]

From: Chris Lilley <chris@w3.org>
Date: Mon, 23 Aug 2010 18:48:18 +0200
Message-ID: <1676848159.20100823184818@w3.org>
To: "Bonner, Matt (IPG)" <matt.bonner@hp.com>
CC: "L. David Baron" <dbaron@dbaron.org>, "www-style (www-style@w3.org)" <www-style@w3.org>, "Refstrup, Jacob Grundtvig" <jacob.refstrup@hp.com>
(This reply is long overdue, sorry)

On Thursday, June 5, 2008, 6:42:21 PM, Matt wrote:

BMI> David Baron wrote:

>> I don't think any change to the specification is needed.  It
>> describes the two features independently, since they are in fact
>> independent.

BMI> The two features could be considered independent, but they interact,
BMI> right?  That is, some compositing operation determines how to apply
BMI> the opacity to an RGBA color, and then how to apply the result to
BMI> the rendering so far.

You are correct, they do interact and this should be described. Both opacity and rgba() use alpha compositing in sRGB space according to the 'source-over' operator in the Porter-Duff model. This has already been standardised as part of SVG 1.1, which is a W3C Recommendation, so the editors draft of CSS3 color references the 'simple alpha compositing' part of that specification.

http://dev.w3.org/csswg/css3-color

BMI> More generally, it seems like clarifying what exactly the opacity 
BMI> property does might help. Currently, the spec says:

>> Opacity can be thought of conceptually as a postprocessing operation.
>> Conceptually, after the element (including its children) is rendered
>> into an RGBA offscreen image, the opacity setting specifies how to
>> blend the offscreen rendering into the current composite rendering.

BMI> Which doesn't seem quite right. The opacity doesn't say *how* to blend
BMI> an element into the existing rendering, a "compositing" property would
BMI> say how to do that [1]. 

Again, correct. The only compositing operation allowed in CSS3 color is the src-over operator.

BMI> The opacity property only specifies the fraction
BMI> of light penetration blocked by this element, right?

Yes. 

BMI> It seems like getting all browsers to look the same might also require
BMI> specifying the blending operation.  Perhaps that is specified in the
BMI> spec, but I didn't see it near the descriptions of opacity, rgba or
BMI> alphavalue.

The equation for the blending operation is now specified in the editors draft of CSS3 color, and uses src-over in sRGB space as does SVG.

Thanks for your review, which has resulted in a useful clarification of the specification.
http://dev.w3.org/csswg/css3-color


-- 
 Chris Lilley   Technical Director, Interaction Domain                 
 W3C Graphics Activity Lead, Fonts Activity Lead
 Co-Chair, W3C Hypertext CG
 Member, CSS, WebFonts, SVG Working Groups
Received on Monday, 23 August 2010 16:47:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:30 GMT