I. Define
Sc source color component
Sa source alpha component
Sca source color premultiplied alpha component
Dc destination color component
Da destination alpha component
Dca destination color premultiplied alpha component
Dc' result of the destination color component
Da' result of the destination alpha component
Dca' result of the destination color premultiplied alpha component
II. Porter & Duff General Operation.
Dca' = Fs * Sca + Fd * Dca
Da' = Fs * Sa + Fd * Da
Fs is function of Da
Fd is function of Sa
III. Java AlphaCompositing.
Import a const alpha value 'Ca' to source alpha
Dca' = Fs * Sca * Ca + Fd * Dca
Da' = Fs * Sa * Ca + Fd * Da
Fs is function of Da
Fd is function of Sa
IV. SVG 1.2 Draft Alpha Compositing
On basic Porter & Duff Artical there are 12 basic type of compositing
operations which is :
SRC, SRC_OVER, SRC_IN, SRC_OUT, SRC_ATOP,
DST, DSR_OVER, DST_IN, DST_OUT, DST_ATOP,
CLEAR, XOR,
The base set of the 12 Porter-Duff operations always result in a value
between zero and one, no clamping of output is required.
In addition of the 12 Porter-Duff operations, a number of _blending_
operations are extensions. These may result in color and opacity values
outside the range. (Note: premultiplied color value must in range of zero
to the opacity value)
Dca' = F * Sa * Da + Y * Sca * (1-Da) + Z * Dca * (1-Sa)
Da' = X * Sa * Da + Y * Sa * (1-Da) + Z * Da * (1-Sa)
F is function of Sc,Dc
CLEAR:
F = 0, X = 0, Y = 0, Z = 0
Dca' = 0
Da' = 0
SRC:
F = Sc, X = 1, Y = 1, Z = 0
Dca' = Sca
Da = Sa
DST:
F = Dc, X = 1, Y = 0, Z = 1
Dca' = Dca
Da = Da
and so on.
For detail see http://www.w3.org/TR/2004/WD-SVG12-20041027/rendering.html
V. PDF Transparency.
Dc' = (1 - Sa/Da') * Dc + (Sa / Da') * ((1-Da) * Sc + Da * F)
Da' = Sa + Da - Sa * Da
F is function of Sc, Dc
so:
Dca' = (1-Sa) * Da * Dc + (1-Da) * Sa * Sc + Da * Sa * F
Da' = Sa + Da - Sa * Da
transform to SVG form:
Dca' = F * Sa * Da + Sca * (1-Da) + Dca * (1-Sa)
Da' = -(Sa * Da)+ Sa + Da
so PDF.F === SVG.F
in PDF:
X = 1, Y = 1, Z = 1
VI.
On each of the above. the SoftMask and ConstAlpha value can be added in.
like this:
Sa' = Sa * CA * SM
Sa' is used as Sa in all above.
Sa is orgin alpha component of source.
CA is const alpha value.
SM is const soft mask value.
VII. Summary.
...
Sc source color component
Sa source alpha component
Sca source color premultiplied alpha component
Dc destination color component
Da destination alpha component
Dca destination color premultiplied alpha component
Dc' result of the destination color component
Da' result of the destination alpha component
Dca' result of the destination color premultiplied alpha component
II. Porter & Duff General Operation.
Dca' = Fs * Sca + Fd * Dca
Da' = Fs * Sa + Fd * Da
Fs is function of Da
Fd is function of Sa
III. Java AlphaCompositing.
Import a const alpha value 'Ca' to source alpha
Dca' = Fs * Sca * Ca + Fd * Dca
Da' = Fs * Sa * Ca + Fd * Da
Fs is function of Da
Fd is function of Sa
IV. SVG 1.2 Draft Alpha Compositing
On basic Porter & Duff Artical there are 12 basic type of compositing
operations which is :
SRC, SRC_OVER, SRC_IN, SRC_OUT, SRC_ATOP,
DST, DSR_OVER, DST_IN, DST_OUT, DST_ATOP,
CLEAR, XOR,
The base set of the 12 Porter-Duff operations always result in a value
between zero and one, no clamping of output is required.
In addition of the 12 Porter-Duff operations, a number of _blending_
operations are extensions. These may result in color and opacity values
outside the range. (Note: premultiplied color value must in range of zero
to the opacity value)
Dca' = F * Sa * Da + Y * Sca * (1-Da) + Z * Dca * (1-Sa)
Da' = X * Sa * Da + Y * Sa * (1-Da) + Z * Da * (1-Sa)
F is function of Sc,Dc
CLEAR:
F = 0, X = 0, Y = 0, Z = 0
Dca' = 0
Da' = 0
SRC:
F = Sc, X = 1, Y = 1, Z = 0
Dca' = Sca
Da = Sa
DST:
F = Dc, X = 1, Y = 0, Z = 1
Dca' = Dca
Da = Da
and so on.
For detail see http://www.w3.org/TR/2004/WD-SVG12-20041027/rendering.html
V. PDF Transparency.
Dc' = (1 - Sa/Da') * Dc + (Sa / Da') * ((1-Da) * Sc + Da * F)
Da' = Sa + Da - Sa * Da
F is function of Sc, Dc
so:
Dca' = (1-Sa) * Da * Dc + (1-Da) * Sa * Sc + Da * Sa * F
Da' = Sa + Da - Sa * Da
transform to SVG form:
Dca' = F * Sa * Da + Sca * (1-Da) + Dca * (1-Sa)
Da' = -(Sa * Da)+ Sa + Da
so PDF.F === SVG.F
in PDF:
X = 1, Y = 1, Z = 1
VI.
On each of the above. the SoftMask and ConstAlpha value can be added in.
like this:
Sa' = Sa * CA * SM
Sa' is used as Sa in all above.
Sa is orgin alpha component of source.
CA is const alpha value.
SM is const soft mask value.
VII. Summary.
...