You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by yi...@apache.org on 2017/03/06 10:26:27 UTC

[2/2] git commit: [flex-asjs] [refs/heads/develop] - Partially working version of BlendBead. Need to put it in graphics and add PixelBender shaders.

Partially working version of BlendBead. Need to put it in graphics and add
PixelBender shaders.


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

Branch: refs/heads/develop
Commit: 1d6b908a8631e064b042801d6180b4cb1de6033b
Parents: 38743ae
Author: yishayw <yi...@hotmail.com>
Authored: Mon Mar 6 12:23:10 2017 +0200
Committer: yishayw <yi...@hotmail.com>
Committed: Mon Mar 6 12:23:10 2017 +0200

----------------------------------------------------------------------
 .../org/apache/flex/html/beads/BlendBead.as     | 97 ++++++++++----------
 .../HTML/src/main/resources/basic-manifest.xml  |  1 +
 2 files changed, 47 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1d6b908a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as
index 663a712..8a93661 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as
@@ -18,19 +18,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads
 {
-	COMPILE::SWF 
+	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IStrand;
+	COMPILE::SWF
 	{
 		import flash.display.BlendMode;
+		import org.apache.flex.core.IRenderedObject;
+		import org.apache.flex.core.IStyleableObject;
+		import org.apache.flex.core.ValuesManager;
 	}
 	
-	import org.apache.flex.core.IBead;
-	import org.apache.flex.core.IRenderedObject;
-	import org.apache.flex.core.IStrand;
-	
 	/**
-	 *  The BlendBead class applies blend style in a uniform syntax
-	 *  to SWF and HTML. Check browser support for blend to see if
-	 *  this bead will work for you in HTML.
+	 *  The BlendBead class translates HTML mixBlendMode CSS values to flash.
+	 *  The JS implementation is degenerated and exists only to enable output
+	 *  agnostic compilation.
 	 *  
 	 *  
 	 *  @langversion 3.0
@@ -38,6 +39,8 @@ package org.apache.flex.html.beads
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
 	 */
+	
+		
 	public class BlendBead implements IBead
 	{
 		/**
@@ -50,53 +53,45 @@ package org.apache.flex.html.beads
 		 */
 		public function BlendBead()
 		{
-			COMPILE::SWF
-			{
-				valueMap = {
-					normal: BlendMode.NORMAL,
-					multiply : BlendMode.MULTIPLY,
-					screen: BlendMode.SCREEN,
-					overlay: BlendMode.OVERLAY,
-					darken: BlendMode.DARKEN,
-					lighten: BlendMode.LIGHTEN,
-					'color-dodge': 'colordodge',
-					'color-burn': 'colorburn',					
-					'hard-light': BlendMode.HARDLIGHT,
-					'soft-light': 'softlight',
-					difference: BlendMode.DIFFERENCE,
-					exclusion: BlendMode.DIFFERENCE, // TODO write custom blend
-					hue: 'hue',
-					saturation: 'saturation',
-					color: 'color',
-					luminosity: 'luminosity'
-				}
-			}
 		}
 		
-		public var value:String;
-		private var valueMap:Object;
-			
-			
-			/**
-			 *  @copy org.apache.flex.core.IBead#strand
-			 *  
-			 *  @langversion 3.0
-			 *  @playerversion Flash 10.2
-			 *  @playerversion AIR 2.6
-			 *  @productversion FlexJS 0.0
-			 */
-			public function set strand(value:IStrand):void
+		COMPILE::SWF
+		private static var MAP:Object = {
+			normal: BlendMode.NORMAL,
+			multiply : BlendMode.MULTIPLY,
+			screen: BlendMode.SCREEN,
+			overlay: BlendMode.OVERLAY,
+			darken: BlendMode.DARKEN,
+			lighten: BlendMode.LIGHTEN,
+			'color-dodge': 'colordodge',
+			'color-burn': 'colorburn',					
+			'hard-light': BlendMode.HARDLIGHT,
+			'soft-light': 'softlight',
+			difference: BlendMode.DIFFERENCE,
+			exclusion: BlendMode.DIFFERENCE, // TODO write custom blend
+			hue: 'hue',
+			saturation: 'saturation',
+			color: 'color',
+			luminosity: 'luminosity'
+		}
+		
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function set strand(value:IStrand):void
+		{
+			COMPILE::SWF
 			{
 				var host:IRenderedObject = value as IRenderedObject;
-				COMPILE::JS 
-				{
-					host.element.style.blendMode = value;
-				}
-				COMPILE::SWF
-				{
-					host.$displayObject.blendMode = valueMap[value];
-				}
+				var blendModeValue:String = ValuesManager.valuesImpl.getValue(IStyleableObject(value), "mix-blend-mode") as String;
+				host.$displayObject.blendMode = MAP[blendModeValue];
 			}
-		
+		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1d6b908a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
index 9e643af..cd70a11 100644
--- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
@@ -82,6 +82,7 @@
     <component id="StringItemRenderer" class="org.apache.flex.html.supportClasses.StringItemRenderer"/>
     <component id="AccordionItemRenderer" class="org.apache.flex.html.supportClasses.AccordionItemRenderer"/>
     <component id="AccordionCollapseBead" class="org.apache.flex.html.beads.AccordionCollapseBead"/>
+    <component id="BlendBead" class="org.apache.flex.html.beads.BlendBead"/>
     <component id="DispatchInputFinishedBead" class="org.apache.flex.html.beads.DispatchInputFinishedBead"/>
     <component id="TreeItemRenderer" class="org.apache.flex.html.supportClasses.TreeItemRenderer"/>
     <component id="DataItemRenderer" class="org.apache.flex.html.supportClasses.DataItemRenderer"/>