flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject [1/2] git commit: [flex-asjs] [refs/heads/develop] - Re-introduce shader classes now that compiler can take embed.
Date Tue, 07 Mar 2017 10:44:12 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 281c77860 -> 53c6beef2


Re-introduce shader classes now that compiler can take embed.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b8a66fb0
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b8a66fb0
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b8a66fb0

Branch: refs/heads/develop
Commit: b8a66fb0dc934a11292382285ff1e8848be50910
Parents: 9657c4e
Author: yishayw <yishayjobs@hotmail.com>
Authored: Tue Mar 7 12:42:02 2017 +0200
Committer: yishayw <yishayjobs@hotmail.com>
Committed: Tue Mar 7 12:42:02 2017 +0200

----------------------------------------------------------------------
 .../src/main/config/compile-as-config.xml       |   1 +
 .../Graphics/src/main/flex/GraphicsClasses.as   |   9 +
 .../flex/graphics/utils/shaderClasses/Color.pbk | 101 +++++++++
 .../graphics/utils/shaderClasses/ColorBurn.pbk  | 149 +++++++++++++
 .../utils/shaderClasses/ColorBurnShader.as      |  60 +++++
 .../graphics/utils/shaderClasses/ColorDodge.pbk | 151 +++++++++++++
 .../utils/shaderClasses/ColorDodgeShader.as     |  60 +++++
 .../graphics/utils/shaderClasses/ColorShader.as |  60 +++++
 .../graphics/utils/shaderClasses/Exclusion.pbk  | 105 +++++++++
 .../utils/shaderClasses/ExclusionShader.as      |  60 +++++
 .../flex/graphics/utils/shaderClasses/Hue.pbk   | 216 ++++++++++++++++++
 .../graphics/utils/shaderClasses/HueShader.as   |  60 +++++
 .../graphics/utils/shaderClasses/Luminosity.pbk | 103 +++++++++
 .../shaderClasses/LuminosityMaskFilter.pbk      | 133 +++++++++++
 .../utils/shaderClasses/LuminosityMaskShader.as |  96 ++++++++
 .../utils/shaderClasses/LuminosityShader.as     |  59 +++++
 .../graphics/utils/shaderClasses/Saturation.pbk | 222 +++++++++++++++++++
 .../utils/shaderClasses/SaturationShader.as     |  59 +++++
 .../graphics/utils/shaderClasses/SoftLight.pbk  | 199 +++++++++++++++++
 .../utils/shaderClasses/SoftLightShader.as      |  59 +++++
 20 files changed, 1962 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/config/compile-as-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/config/compile-as-config.xml b/frameworks/projects/Graphics/src/main/config/compile-as-config.xml
index 75adafe..e665c96 100644
--- a/frameworks/projects/Graphics/src/main/config/compile-as-config.xml
+++ b/frameworks/projects/Graphics/src/main/config/compile-as-config.xml
@@ -32,6 +32,7 @@
 		<binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
 		<binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
 		<binding-value-change-event-type>valueChange</binding-value-change-event-type>
+		<byte-array-embed-class>org.apache.flex.core.ByteArrayAsset</byte-array-embed-class>
 
         <keep-as3-metadata>
           <name>Bindable</name>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
index 3b87a56..5836c9e 100644
--- a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
+++ b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
@@ -41,6 +41,15 @@ internal class GraphicsClasses
 	COMPILE::SWF
 	{
 		import org.apache.flex.graphics.utils.PathHelper; PathHelper;
+		import org.apache.flex.graphics.utils.shaderClasses.ColorBurnShader; ColorBurnShader;
+		import org.apache.flex.graphics.utils.shaderClasses.ColorDodgeShader; ColorDodgeShader;
+		import org.apache.flex.graphics.utils.shaderClasses.ColorShader; ColorShader;
+		import org.apache.flex.graphics.utils.shaderClasses.ExclusionShader; ExclusionShader;
+		import org.apache.flex.graphics.utils.shaderClasses.HueShader; HueShader;
+		import org.apache.flex.graphics.utils.shaderClasses.LuminosityMaskShader; LuminosityMaskShader;
+		import org.apache.flex.graphics.utils.shaderClasses.LuminosityShader; LuminosityShader;
+		import org.apache.flex.graphics.utils.shaderClasses.SaturationShader; SaturationShader;
+		import org.apache.flex.graphics.utils.shaderClasses.SoftLightShader; SoftLightShader;
 	}
 	import org.apache.flex.graphics.QuadraticCurve; QuadraticCurve;
 	import org.apache.flex.graphics.ICircle; ICircle;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Color.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Color.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Color.pbk
new file mode 100644
index 0000000..daedc3f
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Color.pbk
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+kernel Color
+<   namespace : "Flame";
+    vendor : "Adobe";
+    version : 1;
+    description : "Color blend mode";
+>
+{
+    input image4 dst;
+    input image4 src;
+    output pixel4 result;
+
+    // PB bytecode can't do functions, use macros to define common functions
+    // gets the max number out of the three
+    #define max3( x, y, z ) ( max((x), max((y), (z))) )
+    // gets the min number out of the three
+    #define min3( x, y, z ) ( min((x), min((y), (z))) )
+
+    // gets the max number out of the three elements in a vector
+    #define max3v(C) ( max3((C.x), (C.y), (C.z)) )
+    // gets the min number out of the three elements in a vector
+    #define min3v(C) ( min3((C.x), (C.y), (C.z)) )
+
+    // Sat - returns float, takes in a pixel3, or pixel4
+    #define saturation(C) ( (max3((C.r), (C.g), (C.b)) - min3((C.r), (C.g), (C.b))) )
+
+    // Luminance - returns float, takes in a pixel3, or pixel4
+    #define luminance(C) ( (((C.r) * 0.3) + ((C.g) * 0.59) + ((C.b) * 0.11)) )
+
+    void
+    evaluatePixel()
+    {
+        pixel4 a = sampleNearest(dst,outCoord()); // cb
+        pixel4 b = sampleNearest(src,outCoord()); // cs
+        
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+        pixel3 cb = a.rgb;
+        pixel3 cs = b.rgb;
+        if (a.a > 0.0) {
+            cb.rgb = a.rgb / a.a;
+        }
+        if (b.a > 0.0) {
+            cs.rgb = b.rgb / b.a;
+        }
+        
+        // dstA' = (1-srcA)*dstA + srcA
+        result.a = (1.0-b.a)*a.a + b.a;
+        
+        // adjustment -> adjustedcs
+        float3 adjVec = (cb - cs);
+        float adjustment = luminance(adjVec);
+        float3 adjustedcs = cs + adjustment;
+        
+        // Blend()
+        
+        /* --------------------------------------------------------
+         * void clipcolor(inout float3 color)
+         *     clips color.
+         * input and output float3 color_cl
+         * 
+         * -------------------------------------------------------- */
+        float3 color_cl = adjustedcs;
+        float lum_cl = luminance(color_cl);
+        float3 lumVec = float3(lum_cl, lum_cl, lum_cl);
+        float mini = min3v(color_cl);
+        float maxi = max3v(color_cl);
+        if (mini < 0.0) {
+            mini = lum_cl - mini;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*lum_cl/max(mini, 0.0000001);
+        }
+        if (maxi > 1.0) {
+            maxi = maxi - lum_cl;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*(1.0 - lum_cl)/max(maxi, 0.0000001);
+        }
+        // end clipcolor - result: color_cl ---------------------- //
+               
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+        result.rgb = ((1.0-b.a)*a.rgb) + ((1.0-a.a)*b.rgb) + b.a*a.a*color_cl.rgb;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurn.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurn.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurn.pbk
new file mode 100644
index 0000000..99445c2
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurn.pbk
@@ -0,0 +1,149 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+
+kernel ColorBurn
+
+<   namespace : "Flame";
+
+    vendor : "Adobe";
+
+    version : 1;
+
+    description : "ColorBurn blend mode";
+
+>
+
+{
+
+    input image4 dst;
+
+    input image4 src;
+
+    output pixel4 result;
+
+
+
+    void
+
+    evaluatePixel()
+
+    {
+
+        pixel4 a = sampleNearest(dst,outCoord()); //cb
+
+        pixel4 b = sampleNearest(src,outCoord()); //cs
+
+        
+
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+
+        pixel3 cb = a.rgb;
+
+        pixel3 cs = b.rgb;
+
+        if (a.a > 0.0) {
+
+            cb.rgb = a.rgb / a.a;
+
+        }
+
+        if (b.a > 0.0) {
+
+            cs.rgb = b.rgb / b.a;
+
+        }
+
+        
+
+        // dstA' = (1-srcA)*dstA + srcA
+
+        result.a = (1.0-b.a)*a.a + b.a;
+
+        
+
+        // temp for Blend(srcCP/srcA, dstCP/dstA)
+
+        pixel3 blendResult;
+
+
+
+        // = 1, if cb = 1 (*** this case is AE/PS and AGM only, not PDF spec)
+
+        // = 0, if (1 � cb) >= cs
+
+        // = (1 � cb) / cs, otherwise
+
+        if (cb.r == 1.0) {
+
+            blendResult.r = 1.0;
+
+        } else if ((1.0 - cb.r) >= cs.r) {
+
+            blendResult.r = 0.0;
+
+        } else {
+
+            blendResult.r = 1.0 - (1.0 - cb.r) / cs.r;
+
+        }
+
+        
+
+        if (cb.g == 1.0) {
+
+            blendResult.g = 1.0;
+
+        } else if ((1.0 - cb.g) >= cs.g) {
+
+            blendResult.g = 0.0;
+
+        } else {
+
+            blendResult.g = 1.0 - (1.0 - cb.g) / cs.g;
+
+        }
+
+        
+
+        if (cb.b == 1.0) {
+
+            blendResult.b = 1.0;
+
+        } else if ((1.0 - cb.b) >= cs.b) {
+
+            blendResult.b = 0.0;
+
+        } else {
+
+            blendResult.b = 1.0 - (1.0 - cb.b) / cs.b;
+
+        }
+
+        
+
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+
+        result.rgb = (1.0-b.a)*a.rgb + (1.0-a.a)*b.rgb + b.a*a.a*blendResult.rgb;
+
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurnShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurnShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurnShader.as
new file mode 100644
index 0000000..983f091
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorBurnShader.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+	
+/**
+ *  Creates a blend shader that is equivalent to 
+ *  the 'Color Burn' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>The 'colorburn' blend mode can be set on Flex groups and graphic  
+ *  elements and the visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>  
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4 
+ *  
+ *  @includeExample examples/ColorBurnShaderExample.mxml
+ */
+public class ColorBurnShader extends flash.display.Shader
+{
+    [Embed(source="ColorBurn.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+	/**
+	 *  Constructor. 
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+    public function ColorBurnShader()
+    {
+        super(new ShaderClass());
+    }
+	
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodge.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodge.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodge.pbk
new file mode 100644
index 0000000..11d6ca2
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodge.pbk
@@ -0,0 +1,151 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+
+kernel ColorDodge
+
+<   namespace : "Flame";
+
+    vendor : "Adobe";
+
+    version : 1;
+
+    description : "ColorDodge blend mode";
+
+>
+
+{
+
+    input image4 dst;
+
+    input image4 src;
+
+    output pixel4 result;
+
+
+
+    void
+
+    evaluatePixel()
+
+    {
+
+        pixel4 a = sampleNearest(dst,outCoord()); // cb
+
+        pixel4 b = sampleNearest(src,outCoord()); // cs
+
+        
+
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+
+        pixel3 cb = a.rgb;
+
+        pixel3 cs = b.rgb;
+
+        if (a.a > 0.0) {
+
+            cb.rgb = a.rgb / a.a;
+
+        }
+
+        if (b.a > 0.0) {
+
+            cs.rgb = b.rgb / b.a;
+
+        }
+
+        
+
+        // dstA' = (1-srcA)*dstA + srcA
+
+        result.a = (1.0-b.a)*a.a + b.a;
+
+        
+
+        // temp for Blend(srcCP/srcA, dstCP/dstA)
+
+        pixel3 blendResult;
+
+        
+
+        // = 0, if cb = 0 (*** this case is AE/PS and AGM only, not PDF spec)
+
+        // = 1, if cb >= (1 -cs)
+
+        // = cb / (1 -cs), otherwise
+
+        
+
+        if (cb.r == 0.0) {
+
+            blendResult.r = 0.0;
+
+        } else if ( cb.r >= (1.0 - cs.r)) {
+
+            blendResult.r = 1.0;
+
+        } else {
+
+            blendResult.r = cb.r / (1.0 - cs.r);
+
+        }
+
+        
+
+        if (cb.g == 0.0) {
+
+            blendResult.g = 0.0;
+
+        } else if ( cb.g >= (1.0 - cs.g)) {
+
+            blendResult.g = 1.0;
+
+        } else {
+
+            blendResult.g = cb.g / (1.0 - cs.g);
+
+        }
+
+        
+
+        if (cb.b == 0.0) {
+
+            blendResult.b = 0.0;
+
+        } else if ( cb.b >= (1.0 - cs.b)) {
+
+            blendResult.b = 1.0;
+
+        } else {
+
+            blendResult.b = cb.b / (1.0 - cs.b);
+
+        }
+
+                
+
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+
+        result.rgb = (1.0-b.a)*a.rgb + (1.0-a.a)*b.rgb + b.a*a.a*blendResult.rgb;
+
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodgeShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodgeShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodgeShader.as
new file mode 100644
index 0000000..42ff269
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorDodgeShader.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+
+/**
+ *  Creates a blend shader that is equivalent to 
+ *  the 'Color Dodge' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>The 'colordodge' blend mode can be set on Flex groups and graphic  
+ *  elements. The visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/ColorDodgeShaderExample.mxml
+ */
+public class ColorDodgeShader extends flash.display.Shader
+{
+    [Embed(source="ColorDodge.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function ColorDodgeShader()
+    {
+        super(new ShaderClass());
+    }
+
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorShader.as
new file mode 100644
index 0000000..9ffb4ed
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ColorShader.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+
+/**
+ *  The ColorShader class creates a blend shader that is equivalent to 
+ *  the 'Color' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  The 'color' blend mode can be set on Flex groups and graphic  
+ *  elements and the visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.  
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/ColorShaderExample.mxml
+ */
+public class ColorShader extends flash.display.Shader
+{
+    [Embed(source="Color.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function ColorShader()
+    {
+        super(new ShaderClass());
+    }
+    
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Exclusion.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Exclusion.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Exclusion.pbk
new file mode 100644
index 0000000..d7fc369
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Exclusion.pbk
@@ -0,0 +1,105 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+
+kernel Exclusion
+
+<   namespace : "Flame";
+
+    vendor : "Adobe";
+
+    version : 1;
+
+    description : "Exclusion blend mode";
+
+>
+
+{
+
+    input image4 dst;
+
+    input image4 src;
+
+    output pixel4 result;
+
+
+
+    void
+
+    evaluatePixel()
+
+    {
+
+        pixel4 a = sampleNearest(dst,outCoord()); // cb
+
+        pixel4 b = sampleNearest(src,outCoord()); // cs
+
+        
+
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+
+        //pixel3 cb, cs;
+
+        pixel3 cb = a.rgb;
+
+        pixel3 cs = b.rgb;
+
+
+
+        if (a.a > 0.0) {
+
+            cb.rgb = a.rgb / a.a;
+
+        }
+
+        if (b.a > 0.0) {
+
+            cs.rgb = b.rgb / b.a;
+
+        }
+
+        
+
+        // dstA' = (1-srcA)*dstA + srcA
+
+        result.a = (1.0-b.a)*a.a + b.a;
+
+        
+
+        // temp for Blend(srcCP/srcA, dstCP/dstA)
+
+        float3 blendResult;
+
+        
+
+        // cb + cs � 2*cs*cb
+
+        blendResult.rgb = cb.rgb + cs.rgb - 2.0*cs.rgb*cb.rgb;
+
+        
+
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+
+        result.rgb = ((1.0-b.a)*a.rgb) + ((1.0-a.a)*b.rgb) + b.a*a.a*blendResult.rgb;
+
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ExclusionShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ExclusionShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ExclusionShader.as
new file mode 100644
index 0000000..690804d
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/ExclusionShader.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+    
+/**
+ *  Creates a blend shader that is equivalent to 
+ *  the 'Exclusion' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>The 'exclusion' blend mode can be set on Flex groups and graphic  
+ *  elements. The visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>  
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/ExclusionShaderExample.mxml
+ */
+public class ExclusionShader extends flash.display.Shader
+{
+    [Embed(source="Exclusion.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function ExclusionShader()
+    {
+        super(new ShaderClass());
+    }
+    
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Hue.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Hue.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Hue.pbk
new file mode 100644
index 0000000..5ef71f6
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Hue.pbk
@@ -0,0 +1,216 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+kernel Hue
+<   namespace : "Flame";
+    vendor : "Adobe";
+    version : 1;
+    description : "Hue blend mode";
+>
+{
+    input image4 dst;
+    input image4 src;
+    output pixel4 result;
+
+    // PB bytecode can't do functions, use macros to define common functions
+    // gets the max number out of the three
+    #define max3( x, y, z ) ( max((x), max((y), (z))) )
+    // gets the min number out of the three
+    #define min3( x, y, z ) ( min((x), min((y), (z))) )
+
+    // gets the max number out of the three elements in a vector
+    #define max3v(C) ( max3((C.x), (C.y), (C.z)) )
+    // gets the min number out of the three elements in a vector
+    #define min3v(C) ( min3((C.x), (C.y), (C.z)) )
+
+    // Sat - returns float, takes in a pixel3, or pixel4
+    #define saturation(C) ( (max3((C.r), (C.g), (C.b)) - min3((C.r), (C.g), (C.b))) )
+
+    // Luminance - returns float, takes in a pixel3, or pixel4
+    #define luminance(C) ( (((C.r) * 0.3) + ((C.g) * 0.59) + ((C.b) * 0.11)) )
+
+    void
+    evaluatePixel()
+    {
+        pixel4 a = sampleNearest(dst,outCoord()); // cb
+        pixel4 b = sampleNearest(src,outCoord()); // cs
+        
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+        pixel3 cb, cs;
+        if (a.a > 0.0) {
+            cb.rgb = a.rgb / a.a;
+        }
+        if (b.a > 0.0) {
+            cs.rgb = b.rgb / b.a;
+        }
+        
+        // dstA' = (1-srcA)*dstA + srcA
+        result.a = (1.0-b.a)*a.a + b.a;
+        
+        
+        // setSat(cs, Sat(cb))
+        
+        // setSat (setSatColor, sat) -> setSatResult
+        /* --------------------------------------------------------
+         * void setsaturation(inout float3 color, in float satVal)
+         *     makes color have the target saturation.
+         * input and output of float3 color
+         * input of the target saturation
+         *
+         * --------------------------------------------------------
+         void setsatcomponents(inout float minComp, inout float midComp, inout float maxComp, in float satVal)
+         {
+             midComp -= minComp;
+             maxComp -= minComp;
+             minComp = 0.0;
+             if (maxComp > 0.0) {
+                 // max(..., 0.0000001) prevents divide by 0
+                 midComp *= satVal/max(maxComp, 0.0000001);
+                 maxComp = satVal;
+             }
+         }
+         */
+
+        float3 color = cs.rgb;
+        float satVal = saturation(cb);
+
+        if (color.x <= color.y) {
+            if (color.y <= color.z) {
+                // x <= y <= z
+                // setsatcomponents(color.x, color.y, color.z, satVal);
+                // min, mid, max, val
+                
+                color.y -= color.x;
+                color.z -= color.x;
+                color.x = 0.0;
+                if (color.z > 0.0) {
+                    // max(..., 0.0000001) prevents divide by 0
+                    color.y *= satVal/max(color.z, 0.0000001);
+                    color.z = satVal;
+                }
+                
+            } else {
+                if (color.x <= color.z) {
+                    // x <= z <= y
+                    // setsatcomponents(color.x, color.z, color.y, satVal);
+                    // min, mid, max, value
+                    
+                    color.z -= color.x;
+                    color.y -= color.x;
+                    color.x = 0.0;
+                    if (color.y > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.z *= satVal/max(color.y, 0.0000001);
+                        color.y = satVal;
+                    }
+                } else {
+                    // z <= x <= y
+                    // setsatcomponents(color.z, color.x, color.y, satVal);
+                    // min, mid, max, val
+                    
+                    color.x -= color.z;
+                    color.y -= color.z;
+                    color.z = 0.0;
+                    if (color.y > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.x *= satVal/max(color.y, 0.0000001);
+                        color.y = satVal;
+                    }
+                }
+            }
+        } else {
+            if (color.x <= color.z) {
+                // y <= x <= z
+                // setsatcomponents(color.y, color.x, color.z, satVal);
+                
+                color.x -= color.y;
+                color.z -= color.y;
+                color.y = 0.0;
+                if (color.z > 0.0) {
+                    // max(..., 0.0000001) prevents divide by 0
+                    color.x *= satVal/max(color.z, 0.0000001);
+                    color.z = satVal;
+                }
+            } else {
+                if (color.y <= color.z) {
+                    // y <= z <= x
+                    // setsatcomponents(color.y, color.z, color.x, satVal);
+                    // min, mid, max, val
+                    
+                    color.z -= color.y;
+                    color.x -= color.y;
+                    color.y = 0.0;
+                    if (color.x > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.z *= satVal/max(color.x, 0.0000001);
+                        color.x = satVal;
+                    }
+                } else {
+                    // z <= y <= x
+                    // setsatcomponents(color.z, color.y, color.x, satVal);
+                    // min, mid, max, val
+                    
+                    color.y -= color.z;
+                    color.x -= color.z;
+                    color.z = 0.0;
+                    if (color.x > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.y *= satVal/max(color.x, 0.0000001);
+                        color.x = satVal;
+                    }
+                }
+            }
+        }
+        // end setSaturation - result: color ---------------------- //
+        
+        // intermediate adjustment (setSatResult) -> adjustedcs
+        float3 adjVec = (cb - color);
+        float adjustment = luminance(adjVec);
+        float3 adjustedcs = color + adjustment;
+        
+        // ClipRGB(adjustedcs) -> blendResult
+        
+        /* --------------------------------------------------------
+         * void clipcolor(inout float3 color)
+         *     clips color.
+         * input and output float3 color_cl
+         * 
+         * -------------------------------------------------------- */
+        float3 color_cl = adjustedcs;
+        float lum_cl = luminance(color_cl);
+        float3 lumVec = float3(lum_cl, lum_cl, lum_cl);
+        float mini = min3v(color_cl);
+        float maxi = max3v(color_cl);
+        if (mini < 0.0) {
+            mini = lum_cl - mini;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*lum_cl/max(mini, 0.0000001);
+        }
+        if (maxi > 1.0) {
+            maxi = maxi - lum_cl;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*(1.0 - lum_cl)/max(maxi, 0.0000001);
+        }
+        // end clipcolor - result: color_cl ---------------------- //
+        
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+        result.rgb = ((1.0-b.a)*a.rgb) + ((1.0-a.a)*b.rgb) + b.a*a.a*color_cl.rgb;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/HueShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/HueShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/HueShader.as
new file mode 100644
index 0000000..92d9aa2
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/HueShader.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+
+/**
+ *  Creates a blend shader that is equivalent to 
+ *  the 'Hue' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>The 'hue' blend mode can be set on Flex groups and graphic  
+ *  elements. The visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>  
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/HueShaderExample.mxml
+ */
+public class HueShader extends flash.display.Shader
+{
+    [Embed(source="Hue.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function HueShader()
+    {
+        super(new ShaderClass());
+    }
+    
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Luminosity.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Luminosity.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Luminosity.pbk
new file mode 100644
index 0000000..586f35d
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Luminosity.pbk
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+kernel Luminosity
+<   namespace : "Flame";
+    vendor : "Adobe";
+    version : 1;
+    description : "Luminosity blend mode";
+>
+{
+    input image4 dst;
+    input image4 src;
+    output pixel4 result;
+
+    // PB bytecode can't do functions, use macros to define common functions
+    // gets the max number out of the three
+    #define max3( x, y, z ) ( max((x), max((y), (z))) )
+    // gets the min number out of the three
+    #define min3( x, y, z ) ( min((x), min((y), (z))) )
+
+    // gets the max number out of the three elements in a vector
+    #define max3v(C) ( max3((C.x), (C.y), (C.z)) )
+    // gets the min number out of the three elements in a vector
+    #define min3v(C) ( min3((C.x), (C.y), (C.z)) )
+
+    // Sat - returns float, takes in a pixel3, or pixel4
+    #define saturation(C) ( (max3((C.r), (C.g), (C.b)) - min3((C.r), (C.g), (C.b))) )
+
+    // Luminance - returns float, takes in a pixel3, or pixel4
+    #define luminance(C) ( (((C.r) * 0.3) + ((C.g) * 0.59) + ((C.b) * 0.11)) )
+
+    void
+    evaluatePixel()
+    {
+        pixel4 a = sampleNearest(dst,outCoord()); // cb
+        pixel4 b = sampleNearest(src,outCoord()); // cs
+        
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+        pixel3 cb = a.rgb;
+        pixel3 cs = b.rgb;
+        if (a.a > 0.0) {
+            cb.rgb = a.rgb / a.a;
+        }
+        if (b.a > 0.0) {
+            cs.rgb = b.rgb / b.a;
+        }
+        
+        // dstA' = (1-srcA)*dstA + srcA
+        result.a = (1.0-b.a)*a.a + b.a;
+        
+        // adjustment
+        // color = color + lum_cb - luminance(color);
+        // dstColorOld - dstColor
+        float3 adjVec = cs.rgb - cb.rgb;
+        float adjustment = luminance(adjVec);
+        float3 adjustedColor = cb + adjustment;
+        
+        // ClipRGB(adjustedColor) -> color_cl
+        
+        /* --------------------------------------------------------
+         * void clipcolor(inout float3 color)
+         *     clips color.
+         * input and output float3 color_cl
+         * 
+         * -------------------------------------------------------- */
+        float3 color_cl = adjustedColor;
+        float lum_cl = luminance(color_cl);
+        float3 lumVec = float3(lum_cl, lum_cl, lum_cl);
+        float mini = min3v(color_cl);
+        float maxi = max3v(color_cl);
+        if (mini < 0.0) {
+            mini = lum_cl - mini;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*lum_cl/max(mini, 0.0000001);
+        }
+        if (maxi > 1.0) {
+            maxi = maxi - lum_cl;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*(1.0 - lum_cl)/max(maxi, 0.0000001);
+        }
+        // end clipcolor - result: color_cl ---------------------- //
+            
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+        result.rgb = ((1.0-b.a)*a.rgb) + ((1.0-a.a)*b.rgb) + b.a*a.a*color_cl.rgb;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskFilter.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskFilter.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskFilter.pbk
new file mode 100644
index 0000000..10757a6
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskFilter.pbk
@@ -0,0 +1,133 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+
+kernel LuminosityMaskFilter
+
+<   namespace : "Flame";
+
+    vendor : "Adobe";
+
+    version : 0;
+
+    description : "Luminosity Mask filter - Flex SDK";
+
+>
+
+{
+
+    parameter int mode <
+
+        minValue:int(0);
+
+        maxValue:int(3);
+
+        defaultValue:int(0);
+
+    >;
+
+
+
+    input image4 mask;
+
+    output pixel4 result;
+
+
+
+    void
+
+    evaluatePixel()
+
+    {
+
+        result = sampleNearest(mask, outCoord());
+
+
+
+        // AI Luminosity mask calculation
+
+        // input is artwork mask argb
+
+        // Flex will only use alpha channel in an "alpha" mask
+
+	  // calculate new alpha channel using AI luminosity calculation
+
+
+
+        // invert option is mode bit 1
+
+        // clip option is mode bit 2
+
+
+
+        // if (clip != invert) background = 0 else background = 1
+
+        // luminosity = 0.3*red + 0.59*green + 0.11*blue
+
+        // output alpha = alpha*luminosity + (1-alpha)*background;
+
+        // if (invert) output alpha = 1 - output alpha
+
+
+
+        // calculate alpha*luminosity for result argb
+
+        // in flash, the mask artwork is premultiplied
+
+        // so we use luminosity and not alpha*luminosity
+
+        float alphaLum = (0.3 * result.r) + (0.59 * result.g) + (0.11 * result.b);
+
+        
+
+        // mode 0 - clip 0, invert 0, background 1 = alpha*luminosity + (1-alpha)*1
+
+        if (mode == 0)
+
+            result.a = 1.0 - result.a + alphaLum;
+
+        
+
+        // mode 1 - clip 0, invert 1, background 0 = 1 - (alpha*luminosity + (1-alpha)*0)
+
+        if (mode == 1)
+
+           result.a = 1.0 - alphaLum;
+
+        
+
+        // mode 2 - clip 1, invert 0, background 0 = alpha*luminosity + (1-alpha)*0
+
+        if (mode == 2) 
+
+            result.a = alphaLum;
+
+        
+
+        // mode 3 - clip 1, invert 1, background 1 = 1 - (alpha*luminosity + (1-alpha)*1)
+
+        if (mode == 3)
+
+           result.a = result.a - alphaLum;
+
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskShader.as
new file mode 100644
index 0000000..eff0dec
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityMaskShader.as
@@ -0,0 +1,96 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+
+/**
+ *  Creates a blend shader that is equivalent 
+ *  to the luminosity masking option (also known as soft masking) available  
+ *  in Adobe Creative Suite tools. This mask type is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>A luminosity mask type can be set on Flex groups and graphic  
+ *  elements. The visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>
+ *  
+ *  @see spark.primitives.supportClasses.GraphicElement#maskType
+ *  @see spark.components.supportClasses.GroupBase#maskType 
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/LuminosityMaskShaderExample.mxml
+ */
+
+public class LuminosityMaskShader extends Shader
+{
+    [Embed(source="LuminosityMaskFilter.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+
+	/**
+	 *  Constructor. 
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+    public function LuminosityMaskShader()
+    {
+        super(new ShaderClass());
+    }
+
+    /**
+     *  A convenience field that takes into account whether luminosityClip and/or
+     *  luminosityInvert are on or off. 
+     * 
+     *  <ul>
+     *   <li>mode 0 = luminosityClip off, luminosityInvert off</li>
+     *   <li>mode 1 = luminosityClip off, luminosityInvert on</li>
+     *   <li>mode 2 = luminosityClip on, luminosityInvert off</li>
+     *   <li>mode 3 = luminosityClip on, luminosityInvert on </li>
+     *  </ul>
+     * 
+     *  @see spark.primitives.supportClasses.GraphicElement#luminosityClip
+     *  @see spark.primitives.supportClasses.GraphicElement#luminosityInvert
+     *  @see spark.components.supportClasses.GroupBase#luminosityClip 
+     *  @see spark.components.supportClasses.GroupBase#luminosityInvert
+	 * 
+	 *  @langversion 3.0
+ 	 *  @playerversion Flash 10
+ 	 *  @playerversion AIR 1.5
+ 	 *  @productversion Flex 4
+     */
+    public function get mode():int
+    {
+        return this.data.mode.value;
+    }
+
+    public function set mode(v:int):void
+    {
+		if (mode ==-1)
+				return; 
+        this.data.mode.value=[v];
+    }
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityShader.as
new file mode 100644
index 0000000..b2e81e6
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/LuminosityShader.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+
+/**
+ *  Creates a blend shader that is equivalent to 
+ *  the 'Luminosity' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>The 'luminosity' blend mode can be set on Flex groups and graphic  
+ *  elements. The visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>  
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/LuminosityShaderExample.mxml
+ */
+public class LuminosityShader extends flash.display.Shader
+{
+    [Embed(source="Luminosity.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function LuminosityShader()
+    {
+        super(new ShaderClass());
+    }
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Saturation.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Saturation.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Saturation.pbk
new file mode 100644
index 0000000..e9d3866
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/Saturation.pbk
@@ -0,0 +1,222 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+kernel Saturation
+<   namespace : "Flame";
+    vendor : "Adobe";
+    version : 1;
+    description : "Saturation blend mode";
+>
+{
+    input image4 dst;
+    input image4 src;
+    output pixel4 result;
+
+    // PB bytecode can't do functions, use macros to define common functions
+    // gets the max number out of the three
+    #define max3( x, y, z ) ( max((x), max((y), (z))) )
+    // gets the min number out of the three
+    #define min3( x, y, z ) ( min((x), min((y), (z))) )
+
+    // gets the max number out of the three elements in a vector
+    #define max3v(C) ( max3((C.x), (C.y), (C.z)) )
+    // gets the min number out of the three elements in a vector
+    #define min3v(C) ( min3((C.x), (C.y), (C.z)) )
+
+    // Sat - returns float, takes in a pixel3, or pixel4
+    #define saturation(C) ( (max3((C.r), (C.g), (C.b)) - min3((C.r), (C.g), (C.b))) )
+
+    // Luminance - returns float, takes in a pixel3, or pixel4
+    #define luminance(C) ( (((C.r) * 0.3) + ((C.g) * 0.59) + ((C.b) * 0.11)) )
+
+    void
+    evaluatePixel()
+    {
+        pixel4 a = sampleNearest(dst,outCoord()); // cb
+        pixel4 b = sampleNearest(src,outCoord()); // cs
+        
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+        pixel3 cb = a.rgb;
+        pixel3 cs = b.rgb;
+        if (a.a > 0.0) {
+            cb.rgb = a.rgb / a.a;
+        }
+        if (b.a > 0.0) {
+            cs.rgb = b.rgb / b.a;
+        }
+        
+        // dstA' = (1-srcA)*dstA + srcA
+        result.a = (1.0-b.a)*a.a + b.a;
+        
+        // record old version of cb
+        //float3 old_cb.rgb = cb.rgb;
+        
+        // SetSat(cb, Sat(cs))
+        
+        // setSat (setSatColor, sat) -> setSatResult
+        /* --------------------------------------------------------
+         * void setsaturation(inout float3 color, in float satVal)
+         *     makes color have the target saturation.
+         * input and output of float3 color
+         * input of the target saturation
+         *
+         * --------------------------------------------------------
+         void setsatcomponents(inout float minComp, inout float midComp, inout float maxComp, in float satVal)
+         {
+             midComp -= minComp;
+             maxComp -= minComp;
+             minComp = 0.0;
+             if (maxComp > 0.0) {
+                 // max(..., 0.0000001) prevents divide by 0
+                 midComp *= satVal/max(maxComp, 0.0000001);
+                 maxComp = satVal;
+             }
+         }
+         */
+
+        float3 color = cb.rgb;
+        float satVal = saturation(cs);
+
+        if (color.x <= color.y) {
+            if (color.y <= color.z) {
+                // x <= y <= z
+                // setsatcomponents(color.x, color.y, color.z, satVal);
+                // min, mid, max, val
+                
+                color.y -= color.x;
+                color.z -= color.x;
+                color.x = 0.0;
+                if (color.z > 0.0) {
+                    // max(..., 0.0000001) prevents divide by 0
+                    color.y *= satVal/max(color.z, 0.0000001);
+                    color.z = satVal;
+                }
+                
+            } else {
+                if (color.x <= color.z) {
+                    // x <= z <= y
+                    // setsatcomponents(color.x, color.z, color.y, satVal);
+                    // min, mid, max, value
+                    
+                    color.z -= color.x;
+                    color.y -= color.x;
+                    color.x = 0.0;
+                    if (color.y > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.z *= satVal/max(color.y, 0.0000001);
+                        color.y = satVal;
+                    }
+                } else {
+                    // z <= x <= y
+                    // setsatcomponents(color.z, color.x, color.y, satVal);
+                    // min, mid, max, val
+                    
+                    color.x -= color.z;
+                    color.y -= color.z;
+                    color.z = 0.0;
+                    if (color.y > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.x *= satVal/max(color.y, 0.0000001);
+                        color.y = satVal;
+                    }
+                }
+            }
+        } else {
+            if (color.x <= color.z) {
+                // y <= x <= z
+                // setsatcomponents(color.y, color.x, color.z, satVal);
+                
+                color.x -= color.y;
+                color.z -= color.y;
+                color.y = 0.0;
+                if (color.z > 0.0) {
+                    // max(..., 0.0000001) prevents divide by 0
+                    color.x *= satVal/max(color.z, 0.0000001);
+                    color.z = satVal;
+                }
+            } else {
+                if (color.y <= color.z) {
+                    // y <= z <= x
+                    // setsatcomponents(color.y, color.z, color.x, satVal);
+                    // min, mid, max, val
+                    
+                    color.z -= color.y;
+                    color.x -= color.y;
+                    color.y = 0.0;
+                    if (color.x > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.z *= satVal/max(color.x, 0.0000001);
+                        color.x = satVal;
+                    }
+                } else {
+                    // z <= y <= x
+                    // setsatcomponents(color.z, color.y, color.x, satVal);
+                    // min, mid, max, val
+                    
+                    color.y -= color.z;
+                    color.x -= color.z;
+                    color.z = 0.0;
+                    if (color.x > 0.0) {
+                        // max(..., 0.0000001) prevents divide by 0
+                        color.y *= satVal/max(color.x, 0.0000001);
+                        color.x = satVal;
+                    }
+                }
+            }
+        }
+        // end setSaturation - result: color ---------------------- //
+        
+        // adjustment
+        //color = color + lum_cb - luminance(color);
+        //dstColorOld - dstColor
+        float3 adjVec = cb.rgb - color.rgb;
+        float adjustment = luminance(adjVec);
+        float3 adjustedColor = color + adjustment;
+        
+        // ClipRGB(adjustedColor) -> color_cl
+        
+        /* --------------------------------------------------------
+         * void clipcolor(inout float3 color)
+         *     clips color.
+         * input and output float3 color_cl
+         * 
+         * -------------------------------------------------------- */
+        float3 color_cl = adjustedColor;
+        float lum_cl = luminance(color_cl);
+        float3 lumVec = float3(lum_cl, lum_cl, lum_cl);
+        float mini = min3v(color_cl);
+        float maxi = max3v(color_cl);
+        if (mini < 0.0) {
+            mini = lum_cl - mini;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*lum_cl/max(mini, 0.0000001);
+        }
+        if (maxi > 1.0) {
+            maxi = maxi - lum_cl;
+            // max(..., 0.0000001) prevents divide by 0
+            color_cl = lumVec + (color_cl - lumVec)*(1.0 - lum_cl)/max(maxi, 0.0000001);
+        }
+        // end clipcolor - result: color_cl ---------------------- //
+        
+        
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+        result .rgb = ((1.0-b.a)*a.rgb) + ((1.0-a.a)*b.rgb) + b.a*a.a*color_cl.rgb;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SaturationShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SaturationShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SaturationShader.as
new file mode 100644
index 0000000..a43e6aa
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SaturationShader.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+
+/**
+ *  Creates a blend shader that is equivalent to 
+ *  the 'Saturation' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>The 'saturation' blend mode can be set on Flex groups and graphic  
+ *  elements. The visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>  
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/SaturationShaderExample.mxml
+ */
+public class SaturationShader extends flash.display.Shader
+{
+    [Embed(source="Saturation.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function SaturationShader()
+    {
+        super(new ShaderClass());
+    }
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLight.pbk
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLight.pbk b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLight.pbk
new file mode 100644
index 0000000..e98735a
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLight.pbk
@@ -0,0 +1,199 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+<languageVersion : 1.0;>
+
+kernel SoftLight
+
+<   namespace : "Flame";
+
+    vendor : "Adobe";
+
+    version : 1;
+
+    description : "SoftLight blend mode";
+
+>
+
+{
+
+    input image4 dst;
+
+    input image4 src;
+
+    output pixel4 result;
+
+
+
+    void
+
+    evaluatePixel()
+
+    {
+
+        pixel4 a = sampleNearest(dst,outCoord()); // cb
+
+        pixel4 b = sampleNearest(src,outCoord()); // cs
+
+        
+
+        // remove premultiplied (srcCP/srcA, dstCP/dstA)
+
+        pixel3 cb = a.rgb;
+
+        pixel3 cs = b.rgb;
+
+        if (a.a > 0.0) {
+
+            cb.rgb = a.rgb / a.a;
+
+        }
+
+        if (b.a > 0.0) {
+
+            cs.rgb = b.rgb / b.a;
+
+        }
+
+        
+
+        // dstA' = (1-srcA)*dstA + srcA
+
+        result.a = (1.0-b.a)*a.a + b.a;
+
+        
+
+        // B(cs,cb) = cb � (1 � 2*cs)*cb*(1-cb), if (cs <= 0.5)
+
+        //          = cb + (2*cs � 1)*(D(cb) � cb), otherwise
+
+        
+
+        float3 blendResult;
+
+
+
+        // red
+
+        if (cs.r <= 0.5) {
+
+            blendResult.r = cb.r - (1.0 - clamp(2.0*cs.r,0.0,1.0))*cb.r*(1.0-cb.r);
+
+        } else {
+
+            // this could be a helper function, but bytecode doesn't support this
+
+            // = ((16*x � 12)*x +4)*x, if x <= 0.25
+
+            // = x**0.5, otherwise
+
+            float dcb;
+
+            if (cb.r <= 0.25) {
+
+                dcb = ((16.0*cb.r - 12.0) *4.0)*cb.r;
+
+            } else {
+
+                dcb = sqrt(cb.r);
+
+            }
+
+            
+
+            blendResult.r = cb.r + (2.0*cs.r - 1.0)*(dcb - cb.r);
+
+        }
+
+
+
+        // green
+
+        if (cs.g <= 0.5) {
+
+            blendResult.g = cb.g - (1.0 - 2.0*cs.g)*cb.g*(1.0-cb.g);
+
+        } else {
+
+            // = ((16*x � 12)*x +4)*x, if x <= 0.25
+
+            // = x**0.5, otherwise
+
+            float dcb;
+
+            if (cb.g <= 0.25) {
+
+                dcb = ((16.0*cb.g - 12.0) *4.0)*cb.g;
+
+            } else {
+
+                dcb = sqrt(cb.g);
+
+            }
+
+            
+
+            blendResult.g = cb.g + (2.0*cs.g - 1.0)*(dcb - cb.g);
+
+        }
+
+
+
+        // blue
+
+        if (cs.b <= 0.5) {
+
+            blendResult.b = cb.b - (1.0 - 2.0*cs.b)*cb.b*(1.0-cb.b);
+
+        } else {
+
+            // = ((16*x � 12)*x +4)*x, if x <= 0.25
+
+            // = x**0.5, otherwise
+
+            float dcb;
+
+            if (cb.b <= 0.25) {
+
+                dcb = ((16.0*cb.b - 12.0) *4.0)*cb.b;
+
+            } else {
+
+                dcb = sqrt(cb.b);
+
+            }
+
+            
+
+            blendResult.b = cb.b + (2.0*cs.b - 1.0)*(dcb - cb.b);
+
+        }
+
+        
+
+        
+
+        // dstCP' = (1-srcA)*dstCP + (1-dstA)*srcCP + srcA*dstA*Blend(srcCP/srcA, dstCP/dstA)
+
+        result.rgb = (1.0-b.a)*a.rgb + (1.0-a.a)*b.rgb + b.a*a.a*blendResult.rgb;
+
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b8a66fb0/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLightShader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLightShader.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLightShader.as
new file mode 100644
index 0000000..74bae0f
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/utils/shaderClasses/SoftLightShader.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.graphics.utils.shaderClasses
+{
+import flash.display.Shader;
+
+/**
+ *  Creates a blend shader that is equivalent to 
+ *  the 'Soft Light' blend mode for RGB premultiplied colors available 
+ *  in Adobe Creative Suite tools. This blend mode is not native to Flash, 
+ *  but is available in tools like Adobe Illustrator and Adobe Photoshop. 
+ * 
+ *  <p>The 'softlight' blend mode can be set on Flex groups and graphic  
+ *  elements. The visual appearance in tools like Adobe Illustrator and 
+ *  Adobe Photoshop will be mimicked through this blend shader.</p>  
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ *  
+ *  @includeExample examples/SoftLightShaderExample.mxml
+ */
+public class SoftLightShader extends flash.display.Shader
+{
+    [Embed(source="SoftLight.pbj", mimeType="application/octet-stream")]
+    private static var ShaderClass:Class;
+    
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function SoftLightShader()
+    {
+        super(new ShaderClass());
+    }
+}
+}


Mime
View raw message