# HG changeset patch # User Dean Jackson # Date 1315355163 -36000 # Node ID b31bb9367aefd5e9dd037bfd681720c64c1bb70d # Parent 31e848f19cebbc25e6a64aaec04402a838603300 - Added opacity function - Corrected luminanceToAlpha values diff -r 31e848f19ceb -r b31bb9367aef filters/master/ChangeLog --- a/filters/master/ChangeLog Wed Aug 31 10:55:35 2011 +1000 +++ b/filters/master/ChangeLog Wed Sep 07 10:26:03 2011 +1000 @@ -1,6 +1,11 @@ Changes for Filter Effects specification ---------------------------------------- +2011-09-07 Dean Jackson + +- Added opacity function +- Corrected luminanceToAlpha values + 2011-08-31 Dean Jackson - Remove commas from shorthand function parameter input. diff -r 31e848f19ceb -r b31bb9367aef filters/master/Filters.html --- a/filters/master/Filters.html Wed Aug 31 10:55:35 2011 +1000 +++ b/filters/master/Filters.html Wed Sep 07 10:26:03 2011 +1000 @@ -407,6 +407,18 @@
+ opacity(amount) +
+
+ Applies transparency to the samples in the input image. The value of 'amount' defines the proportion + of the conversion. A value of 1 is completely transparent. A value of 0 leaves the + input unchanged. Values between 0 and 1 are linear multipliers on the effect. + This is equivalent to multiplying the input image samples by (1 - amount). + If the 'amount' parameter is missing, a value of 1 is used. + The markup equivalent of this function is given below. +
+ +
gamma(amplitude exponent offset)
@@ -1498,11 +1510,11 @@ equivalent to the following matrix operation:

-
| R' |     |0.213+0.787s  0.715-0.715s  0.072-0.072s 0  0 |   | R |
-| G' |     |0.213-0.213s  0.715+0.285s  0.072-0.072s 0  0 |   | G |
-| B' |  =  |0.213-0.213s  0.715-0.715s  0.072+0.928s 0  0 | * | B |
-| A' |     |           0            0             0  1  0 |   | A |
-| 1  |     |           0            0             0  0  1 |   | 1 |
+
| R' |     | (0.2127 + 0.7873s)  (0.7152 - 0.7152s)  (0.0722 - 0.0722s) 0  0 |   | R |
+| G' |     | (0.2127 - 0.2127s)  (0.7152 + 0.2848s)  (0.0722 - 0.0722s) 0  0 |   | G |
+| B' |  =  | (0.2127 - 0.2127s)  (0.7152 - 0.7152s)  (0.0722 + 0.9278s) 0  0 | * | B |
+| A' |     |           0                   0                   0        1  0 |   | A |
+| 1  |     |           0                   0                   0        0  1 |   | 1 |

@@ -1523,21 +1535,23 @@ where the terms a00, a01, etc. are calculated as follows:

-
| a00 a01 a02 |    [+0.213 +0.715 +0.072]
-| a10 a11 a12 | =  [+0.213 +0.715 +0.072] +
-| a20 a21 a22 |    [+0.213 +0.715 +0.072]
-                        [+0.787 -0.715 -0.072]
-cos(hueRotate value) *  [-0.213 +0.285 -0.072] +
-                        [-0.213 -0.715 +0.928]
-                        [-0.213 -0.715+0.928]
-sin(hueRotate value) *  [+0.143 +0.140-0.283]
-                        [-0.787 +0.715+0.072]
+
| a00 a01 a02 |     [0.2127 0.7152 0.0722]
+| a10 a11 a12 | =   [0.2127 0.7152 0.0722] +
+| a20 a21 a22 |     [0.2127 0.7152 0.0722]
+
+                                            [ 0.7873 -0.7152 -0.0722]
+                    cos(hueRotate value) *  [-0.2127  0.2848 -0.0722] +
+                                            [-0.2127 -0.7152  0.9278]
+
+                                            [-0.2127 -0.7152  0.9278]
+                    sin(hueRotate value) *  [ 0.143   0.140  -0.283 ]
+                                            [-0.7873  0.7152  0.0722]

Thus, the upper left term of the hue matrix turns out to be:

-
.213 + cos(hueRotate value)*.787 - sin(hueRotate value)*.213
+
.2127 + cos(hueRotate value) * 0.7873 - sin(hueRotate value) * 0.2127

@@ -1551,7 +1565,7 @@
   | R' |     |      0        0        0  0  0 |   | R |
    | G' |     |      0        0        0  0  0 |   | G |
    | B' |  =  |      0        0        0  0  0 | * | B |
-   | A' |     | 0.2125   0.7154   0.0721  0  0 |   | A |
+   | A' |     | 0.2127   0.7152   0.0722  0  0 |   | A |
    | 1  |     |      0        0        0  0  1 |   | 1 |

@@ -3614,9 +3628,9 @@
 <filter id="grayscale">
     <feColorMatrix type="matrix"
-               values="(0.2125 * [amount]) (0.7154 * [amount]) (0.0721 * [amount]) 0 0
-                       (0.2125 * [amount]) (0.7154 * [amount]) (0.0721 * [amount]) 0 0
-                       (0.2125 * [amount]) (0.7154 * [amount]) (0.0721 * [amount]) 0 0
+               values="(0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
+                       (0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
+                       (0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
                        0 0 0 1 0"/>
   </filter> 
@@ -3654,6 +3668,14 @@ </feComponentTransfer> </filter> +

opacity

+ +
 <filter id="opacity">
+    <feComponentTransfer>
+        <feFuncA type="table" tableValues="0 [amount]"/>
+    </feComponentTransfer>
+  </filter> 
+

gamma

 <filter id="gamma">
diff -r 31e848f19ceb -r b31bb9367aef filters/publish/ChangeLog
--- a/filters/publish/ChangeLog	Wed Aug 31 10:55:35 2011 +1000
+++ b/filters/publish/ChangeLog	Wed Sep 07 10:26:03 2011 +1000
@@ -1,6 +1,11 @@
 Changes for Filter Effects specification
 ----------------------------------------
 
+2011-09-07  Dean Jackson  
+
+- Added opacity function
+- Corrected luminanceToAlpha values
+
 2011-08-31  Dean Jackson  
 
 - Remove commas from shorthand function parameter input.
diff -r 31e848f19ceb -r b31bb9367aef filters/publish/Filters.html
--- a/filters/publish/Filters.html	Wed Aug 31 10:55:35 2011 +1000
+++ b/filters/publish/Filters.html	Wed Sep 07 10:26:03 2011 +1000
@@ -14,7 +14,7 @@
 

W3C

Filter Effects 1.0: Language

-

W3C Editor’s Draft 31 August 2011

+

W3C Editor’s Draft 07 September 2011

This version:
https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/publish/Filters.html
Latest version:
http://www.w3.org/TR/FilterEffects10/
Previous version:
http://www.w3.org/TR/2007/WD-SVGFilter12-20070501/
Editors:
Erik Dahlström, (Opera Software ASA)
Dean Jackson (Apple Inc)
Authors:
The authors of this specification are the participants of the W3C SVG and CSS Working Groups.
@@ -142,10 +142,11 @@
  • 32.3 saturate
  • 32.4 hue-rotate
  • 32.5 invert
  • -
  • 32.6 gamma
  • -
  • 32.7 blur
  • -
  • 32.8 sharpen
  • -
  • 32.9 drop-shadow
  • +
  • 32.6 opacity
  • +
  • 32.7 gamma
  • +
  • 32.8 blur
  • +
  • 32.9 sharpen
  • +
  • 32.10 drop-shadow
  • 33 DOM interfaces
  • + opacity(amount) +
    + Applies transparency to the samples in the input image. The value of 'amount' defines the proportion + of the conversion. A value of 1 is completely transparent. A value of 0 leaves the + input unchanged. Values between 0 and 1 are linear multipliers on the effect. + This is equivalent to multiplying the input image samples by (1 - amount). + If the 'amount' parameter is missing, a value of 1 is used. + The markup equivalent of this function is given below. +
    gamma(amplitude exponent offset)
    Applies a gamma function to the input image. @@ -1369,11 +1379,11 @@ equivalent to the following matrix operation:

    -
    | R' |     |0.213+0.787s  0.715-0.715s  0.072-0.072s 0  0 |   | R |
    -| G' |     |0.213-0.213s  0.715+0.285s  0.072-0.072s 0  0 |   | G |
    -| B' |  =  |0.213-0.213s  0.715-0.715s  0.072+0.928s 0  0 | * | B |
    -| A' |     |           0            0             0  1  0 |   | A |
    -| 1  |     |           0            0             0  0  1 |   | 1 |
    +
    | R' |     | (0.2127 + 0.7873s)  (0.7152 - 0.7152s)  (0.0722 - 0.0722s) 0  0 |   | R |
    +| G' |     | (0.2127 - 0.2127s)  (0.7152 + 0.2848s)  (0.0722 - 0.0722s) 0  0 |   | G |
    +| B' |  =  | (0.2127 - 0.2127s)  (0.7152 - 0.7152s)  (0.0722 + 0.9278s) 0  0 | * | B |
    +| A' |     |           0                   0                   0        1  0 |   | A |
    +| 1  |     |           0                   0                   0        0  1 |   | 1 |

  • For type="hueRotate", values is a single one real number value @@ -1392,21 +1402,23 @@ where the terms a00, a01, etc. are calculated as follows:

    -
    | a00 a01 a02 |    [+0.213 +0.715 +0.072]
    -| a10 a11 a12 | =  [+0.213 +0.715 +0.072] +
    -| a20 a21 a22 |    [+0.213 +0.715 +0.072]
    -                        [+0.787 -0.715 -0.072]
    -cos(hueRotate value) *  [-0.213 +0.285 -0.072] +
    -                        [-0.213 -0.715 +0.928]
    -                        [-0.213 -0.715+0.928]
    -sin(hueRotate value) *  [+0.143 +0.140-0.283]
    -                        [-0.787 +0.715+0.072]
    +
    | a00 a01 a02 |     [0.2127 0.7152 0.0722]
    +| a10 a11 a12 | =   [0.2127 0.7152 0.0722] +
    +| a20 a21 a22 |     [0.2127 0.7152 0.0722]
    +
    +                                            [ 0.7873 -0.7152 -0.0722]
    +                    cos(hueRotate value) *  [-0.2127  0.2848 -0.0722] +
    +                                            [-0.2127 -0.7152  0.9278]
    +
    +                                            [-0.2127 -0.7152  0.9278]
    +                    sin(hueRotate value) *  [ 0.143   0.140  -0.283 ]
    +                                            [-0.7873  0.7152  0.0722]

    Thus, the upper left term of the hue matrix turns out to be:

    -
    .213 + cos(hueRotate value)*.787 - sin(hueRotate value)*.213
    +
    .2127 + cos(hueRotate value) * 0.7873 - sin(hueRotate value) * 0.2127

    @@ -1418,7 +1430,7 @@
       | R' |     |      0        0        0  0  0 |   | R |
        | G' |     |      0        0        0  0  0 |   | G |
        | B' |  =  |      0        0        0  0  0 | * | B |
    -   | A' |     | 0.2125   0.7154   0.0721  0  0 |   | A |
    +   | A' |     | 0.2127   0.7152   0.0722  0  0 |   | A |
        | 1  |     |      0        0        0  0  1 |   | 1 |

    @@ -3545,9 +3557,9 @@
     <filter id="grayscale">
         <feColorMatrix type="matrix"
    -               values="(0.2125 * [amount]) (0.7154 * [amount]) (0.0721 * [amount]) 0 0
    -                       (0.2125 * [amount]) (0.7154 * [amount]) (0.0721 * [amount]) 0 0
    -                       (0.2125 * [amount]) (0.7154 * [amount]) (0.0721 * [amount]) 0 0
    +               values="(0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
    +                       (0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
    +                       (0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
                            0 0 0 1 0"/>
       </filter> 
    @@ -3585,7 +3597,15 @@ </feComponentTransfer> </filter> -

    32.6 gamma

    +

    32.6 opacity

    + +
     <filter id="opacity">
    +    <feComponentTransfer>
    +        <feFuncA type="table" tableValues="0 [amount]"/>
    +    </feComponentTransfer>
    +  </filter> 
    + +

    32.7 gamma

     <filter id="gamma">
         <feComponentTransfer>
    @@ -3595,19 +3615,19 @@
         </feComponentTransfer>
       </filter> 
    -

    32.7 blur

    +

    32.8 blur

     <filter id="blur">
         <feGaussianBlur stdDeviation="[radiusX radiusY]">
       </filter> 
    -

    32.8 sharpen

    +

    32.9 sharpen

     <filter id="unsharp">
         <feUnsharpMask stdDeviation="[radius]" threshold="[threshold]" amount="[amount]">
       </filter> 
    -

    32.9 drop-shadow

    +

    32.10 drop-shadow

     <filter id="drop-shadow">
         <feGaussianBlur in="[alpha-channel-of-input]" stdDeviation="[radius]"/>