RE: [css-compositing] some proposals

--
NB: Sorry for the spam www-svg (note to self: debug mailer agent;-(
--
Hi Cyril & Rik,

	Sorry I've been a bit busy of late so following up now.

	First, one thing that's been missed is that in Porter-Duff
the alpha channel represents a mask. The crux of the original paper
is representing what happens with shape overlap on a pixel and so
in the compositing spec. we reproduce the 'square with 4 areas'
that has the top section multi-coloured, the left yellow, the right
blue and the bottom white.

	Those areas represent 0, A, B, and AB in the original P-D
paper.

	In the spec. further down where it says:
"The operation used to place objects onto the background is as follows"

there are these equations:
Dca' = f(Sc, Dc) × Sa × Da  + Y × Sca × (1-Da)  + Z × Dca × (1-Sa)
Da'  =         X × Sa × Da  + Y × Sa × (1-Da)   + Z × Da × (1-Sa)

	The Porter-Duff mode chosen affects X, Y, and Z.

	The blend mode is f(Sc, Dc).

	So for example if you chose blend-mode:multiply, comp-op:src-in; you
would get:

f(Sc,Dc) = Sc × Dc
X        = 1
Y        = 0
Z        = 0

and so:

Dca' = Sc × Dc * Sa * Da + 0 * Sca × (1-Da) + 0 * Dca × (1-Sa)
Da' = 1 * Sa × Da + 0 * Sa × (1-Da) + 0 × Da × (1-Sa)

simplified to:

Dca' = Sc × Dc * Sa * Da
Da' = Sa × Da

which results in a multiply in the area covered by both source and destination.

So the f(Sc, Dc), X, Y, and Z refer to the four areas in the square
diagram.

All this means is that blending and compositing happen at the same time
there is no order of operation at all.

On the subject of naming, comp-op does suck and so better terms make
sense. I'm not sure I like alpha-compositing since it's really a shape
operation rather than the original idea of alpha Alvy-style.

Perhaps we could call it porter-duff to make the Thomas' happy...

I also prefer blend-mode/blending-mode/color-function or whatever.

Graphic artists already understand blend modes in their workflow so
I'd hate to give it a non obvious name like color-compositing which
could mean ICC profile or whatever.

What about shape-mode/blend-mode which is another possibility.

Cheers,
Alex

--Original Message--:
>Hi Rik, Alex,
>
> 
>Just to make sure I understand the proposal. What would happen if you apply the ‘dst-atop’ compositing operator with partially transparent objects together with say a ‘plus’ blending operator. I understand that the ‘plus’ would only apply on the intersection but I’m not sure about the maths. Would you compose the equations, in which order? It doesn’t look like you can consider that the result of the (alpha-)compositing becomes the source (or destination) of the (color-compositing) blending ,does it? 
>
> 
>Regards,
>
>Cyril
>
> 
> 
>From: Rik Cabanier [mailto:cabanier@gmail.com] 
>Sent: Friday, 18 November 2011 4:11 PM
>To: www-svg; public-fx@w3.org
>Subject: [css-compositing] some proposals
>
> 
>Last week I sent out some ideas to update the SVG composting spec: http://www.w3.org/TR/SVGCompositing/.
>
>Some people suggested some improvements which I integrated.
>
> 
>Here is the updated list of proposals:
>
>a. split up the spec in 2 sections: Porter-Duff & Blending. 
>
>Porter-Duff are compositing primitives that describes how 2 images (src+dst) can be merged.
>
>Porter-Duff will continue to use the existing comp-op property.
>
> 
>Blending describes how the top image will 'blend' with its underlying colors. The result of this is a new blended image. In the Adobe imaging model and the existing SVG compositing spec it is assumed that this blended image is composited with src-over.
>
>However, there are use cases where you might not want 'src-over'. To facilitate other composting operators, we will introduce a new keyword 'blend-mode'.
>
> 
>b. simplify Porter-Duff
>
>-remove the clip-to-self property. The default behavior becomes 'clip-to-self: object'.
>
> 
>c. complete blend modes
>
>- add the following missing blend modes: hue, saturation, color & luminosity
>
>- define 'normal' as the default blend mode
>
> 
>d. update knockout
>
>- change the value to be more descriptive. The new value ('replace'/'preserve') is confusing.
>
>- provide a better description + correct the compositing formula
>
>- knockout will only affect groups that use the new 'blend-mode' operator
>
> 
>e. update enable-background
>
>- remove the ability to set up x, y, width & height.
>
>- clarify the description and refer to the filters spec which already defines this parameter
>
>- replace the keyword with 'isolate' which is Adobe's equivalent. 'isolate: isolated' = 'enable-background: new'. Keep the existing parameter for backward compatibility.
>
>- Any comp-op apart from 'src-over' will establish a new stacking context.
>
> 
>f. update all the formulas on the page
>
>- fix incorrect math
>
>- always do the math with pre-multiplied alpha.
>
> 
>g. replace 'src'/'dst' in the spec with 'source'/'dest'
>
> 
>Let me know if I missed something.
>
> 
>Rik
>
> 
> 
>The information contained in this email message and any attachments may be confidential and may also be the subject to legal professional privilege. If you are not the intended recipient, any use, interference with, disclosure or copying of this material is unauthorised and prohibited. If you have received this email in error, please immediately advise the sender by return email and delete the information from your system. 
>
>

Received on Tuesday, 22 November 2011 02:01:22 UTC