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:26 UTC

[1/2] git commit: [flex-asjs] [refs/heads/develop] - First version of BlendBead

Repository: flex-asjs
Updated Branches:
  refs/heads/develop be0682c25 -> 1d6b908a8


First version of BlendBead


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

Branch: refs/heads/develop
Commit: 38743ae6c5a2d32f4cd6a0e7a585b5607c79d944
Parents: be0682c
Author: yishayw <yi...@hotmail.com>
Authored: Mon Mar 6 10:15:43 2017 +0200
Committer: yishayw <yi...@hotmail.com>
Committed: Mon Mar 6 10:15:43 2017 +0200

----------------------------------------------------------------------
 .../org/apache/flex/html/beads/BlendBead.as     | 102 +++++++++++++++++++
 1 file changed, 102 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/38743ae6/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
new file mode 100644
index 0000000..663a712
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BlendBead.as
@@ -0,0 +1,102 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.html.beads
+{
+	COMPILE::SWF 
+	{
+		import flash.display.BlendMode;
+	}
+	
+	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.
+	 *  
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class BlendBead implements IBead
+	{
+		/**
+		 *  Constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		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
+			{
+				var host:IRenderedObject = value as IRenderedObject;
+				COMPILE::JS 
+				{
+					host.element.style.blendMode = value;
+				}
+				COMPILE::SWF
+				{
+					host.$displayObject.blendMode = valueMap[value];
+				}
+			}
+		
+	}
+}


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

Posted by yi...@apache.org.
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"/>