royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject [royale-asjs] branch feature/revert-refactor updated: Added merge, and more
Date Mon, 30 Jul 2018 10:29:42 GMT
This is an automated email from the ASF dual-hosted git repository.

yishayw pushed a commit to branch feature/revert-refactor
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/revert-refactor by this push:
     new 24c04ad  Added merge, and more
     new 9920b61  Merge branch 'feature/revert-refactor' of https://github.com/apache/royale-asjs
into feature/revert-refactor
24c04ad is described below

commit 24c04ad77c81f6c4a972dcaa56107e944af0886d
Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
AuthorDate: Mon Jul 30 13:29:18 2018 +0300

    Added merge, and more
---
 .../Graphics/src/main/resources/svg-manifest.xml   |  1 +
 .../org/apache/royale/svg/BlendFilterElement.as    | 12 -----
 .../apache/royale/svg/CompositeFilterElement.as    |  1 +
 .../org/apache/royale/svg/DropShadowFilter.as      | 54 ++++++++++++++++++----
 .../royale/org/apache/royale/svg/FilterElement.as  | 15 ++++++
 ...eFilterElement.as => FullAlphaFilterElement.as} | 48 ++++++-------------
 ...ositeFilterElement.as => MergeFilterElement.as} | 45 ++++++++----------
 .../org/apache/royale/svg/SuperimposeFilter.as     |  8 +++-
 8 files changed, 104 insertions(+), 80 deletions(-)

diff --git a/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml b/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
index b453bca..72aa7a5 100644
--- a/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
+++ b/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
@@ -29,6 +29,7 @@
 	<component id="SpreadFilterElement" class="org.apache.royale.svg.SpreadFilterElement"
/>
 	<component id="BlurFilterElement" class="org.apache.royale.svg.BlurFilterElement" />
 	<component id="InvertFilterElement" class="org.apache.royale.svg.InvertFilterElement"
/>
+	<component id="FullAlphaFilterElement" class="org.apache.royale.svg.FullAlphaFilterElement"
/>
 	<component id="CompositeFilterElement" class="org.apache.royale.svg.CompositeFilterElement"
/>
 	<component id="BlendFilterElement" class="org.apache.royale.svg.BlendFilterElement" />
 	<component id="MaskBead" class="org.apache.royale.svg.MaskBead" />
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlendFilterElement.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlendFilterElement.as
index 6c4eac3..b658352 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlendFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlendFilterElement.as
@@ -40,7 +40,6 @@ package org.apache.royale.svg
 	{
 		private var _strand:IStrand;
 		private var _in2:String;
-		private var _in:String;
 
 		public function BlendFilterElement()
 		{
@@ -54,7 +53,6 @@ package org.apache.royale.svg
 			COMPILE::JS 
 			{
 				super.build();
-				filterElement.setAttribute("in", in);
 				filterElement.setAttribute("in2", in2);
 				filterElement.setAttribute("mode", "normal");
 			}
@@ -78,16 +76,6 @@ package org.apache.royale.svg
 			_in2 = value;
 		}
 
-		public function get in():String 
-		{
-			return _in;
-		}
-		
-		public function set in(value:String):void 
-		{
-			_in = value;
-		}
-
 		COMPILE::JS
 		override protected function get filterElementType():String
 		{
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
index a01ce4b..dba53ca 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
@@ -81,6 +81,7 @@ package org.apache.royale.svg
 		{
 			return "feComposite";
 		}
+
 	}
 }
 
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/DropShadowFilter.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/DropShadowFilter.as
index 02cdce9..c89859b 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/DropShadowFilter.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/DropShadowFilter.as
@@ -45,6 +45,7 @@ package org.apache.royale.svg
 		private var _opacity:Number = 1;
 		private var _spread:Number = 1;
 		private var _inset:Boolean;
+		private var _knockout:Boolean;
 		private var _source:String;
 		private var _result:String;
 
@@ -55,21 +56,47 @@ package org.apache.royale.svg
 		public function build():void
 		{
 			children = [];
+			var knockoutResult:String;
+			if (!inset && knockout)
+			{
+				knockoutResult = "knockout_res1";
+//				var fullAlpha:ColorMatrixFilterElement = new ColorMatrixFilterElement();
+//				fullAlpha.opacity = 1000000;
+//				fullAlpha.result = knockoutResult;
+//				fullAlpha.in = "SourceAlpha";
+//				children.push(fullAlpha);
+			}
 			if (inset)
 			{
 				var insetFilterElement:FilterElement = new InvertFilterElement();
 				children.push(insetFilterElement);
 			}
+			var offset:OffsetFilterElement;
 			if (!isNaN(dx) && !isNaN(dy) && (dx !=0 || dy !=0))
 			{
-				var offset:OffsetFilterElement = new OffsetFilterElement();
+				offset = new OffsetFilterElement();
 				children.push(offset);
 				offset.dx = dx;
 				offset.dy = dy;
+				if (knockoutResult)
+				{
+					offset.in = source ? source : "SourceGraphic";
+				}
 			}
 			var blur:BlurFilterElement = new BlurFilterElement();
 			children.push(blur);
 			blur.stdDeviation = stdDeviation;
+			if (!offset)
+			{
+				blur.in = source ? source : "SourceGraphic";
+			}
+			if (!inset && knockout)
+			{
+				var outsetComposite:CompositeFilterElement = new CompositeFilterElement();
+				children.push(outsetComposite);
+				outsetComposite.in2 = knockoutResult;
+				outsetComposite.operator = "out";
+			}
 			var colorMatrix:ColorMatrixFilterElement = new ColorMatrixFilterElement();
 			children.push(colorMatrix);
 			colorMatrix.red = red;
@@ -80,7 +107,7 @@ package org.apache.royale.svg
 			children.push(spreadElement);
 			if (!inset)
 			{
-				spreadElement.result = "spreadResult";
+				spreadElement.result = result ? result : "spreadResult";
 			}
 			spreadElement.spread = spread;
 			if (inset)
@@ -89,15 +116,14 @@ package org.apache.royale.svg
 				children.push(composite);
 				composite.in2 = "SourceAlpha";
 				composite.operator = "in";
-				composite.result = "compositeResult";
+				composite.result = result ? result : "compositeResult";
 			}
-			var blend:BlendFilterElement = new BlendFilterElement();
-			children.push(blend);
-			blend.in = inset ? "compositeResult" : source ? source : "SourceGraphic";
-			blend.in2 = inset && !source ? "SourceGraphic" : inset && source ? source
: "spreadResult";
-			if (result)
+			if (!result)
 			{
-				blend.result = result;
+				var blend:BlendFilterElement = new BlendFilterElement();
+				children.push(blend);
+				blend.in = inset ? "compositeResult" : source ? source : "SourceGraphic";
+				blend.in2 = inset && !source ? "SourceGraphic" : inset && source ? source
: "spreadResult";
 			}
 		}
 
@@ -299,6 +325,16 @@ package org.apache.royale.svg
 		{
 			_result = value;
 		}
+
+		public function get knockout():Boolean 
+		{
+			return _knockout;
+		}
+		
+		public function set knockout(value:Boolean):void 
+		{
+			_knockout = value;
+		}
 	}
 }
 
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/FilterElement.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/FilterElement.as
index 0e7e1fd..f063f02 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/FilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/FilterElement.as
@@ -45,6 +45,7 @@ package org.apache.royale.svg
 			private var _filterElement:Element;
 		}
 		private var _result:String;
+		private var _in:String;
 
 		public function FilterElement()
 		{
@@ -62,6 +63,10 @@ package org.apache.royale.svg
 				{
 					filterElement.setAttribute("result", result);
 				}
+				if (_in)
+				{
+					filterElement.setAttribute("in", _in);
+				}
 			}
 		}
 		
@@ -116,6 +121,16 @@ package org.apache.royale.svg
 		{
 			_filterElementWrapper = value;
 		}
+
+		public function get in():String 
+		{
+			return _in;
+		}
+		
+		public function set in(value:String):void 
+		{
+			_in = value;
+		}
 	}
 }
 
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/FullAlphaFilterElement.as
similarity index 67%
copy from frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
copy to frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/FullAlphaFilterElement.as
index a01ce4b..8b30982 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/FullAlphaFilterElement.as
@@ -19,6 +19,8 @@
 package org.apache.royale.svg
 {
 	
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.Event;
 	COMPILE::JS 
 	{
@@ -26,61 +28,41 @@ package org.apache.royale.svg
 	}
 
 	/**
-	 *  The CompositeFilterElement takes two objects and applies Porter/Duff operators
+	 *  The FullAlphaFilterElement 
 	 *  
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class CompositeFilterElement extends FilterElement
+	public class FullAlphaFilterElement extends FilterElement
 	{
-		private var _in2:String;
-		private var _operator:String;
+		
 
-		public function CompositeFilterElement()
+		public function FullAlphaFilterElement()
 		{
 		}
 		
-		
-		/**
-		 * @royaleignorecoercion Element
-		 */
+		/*
+		* @royaleignorecoercion Element
+		*/
 		override public function build():void
 		{
 			COMPILE::JS 
 			{
 				super.build();
-				filterElement.setAttribute("in2", in2);
-				filterElement.setAttribute("operator", operator);
+				var funcA:Element = addSvgElementToElement(filterElement, "feFuncA") as Element;
+				funcA.setAttribute("type", "table");
+				funcA.setAttribute("tableValues", "1");
 			}
 		}
-
-		public function get in2():String 
-		{
-			return _in2;
-		}
-		
-		public function set in2(value:String):void 
-		{
-			_in2 = value;
-		}
-
-		public function get operator():String 
-		{
-			return _operator;
-		}
-		
-		public function set operator(value:String):void 
-		{
-			_operator = value;
-		}
-
+			
 		COMPILE::JS
 		override protected function get filterElementType():String
 		{
-			return "feComposite";
+			return "feComponentTransfer";
 		}
+
 	}
 }
 
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MergeFilterElement.as
similarity index 68%
copy from frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
copy to frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MergeFilterElement.as
index a01ce4b..fcc033f 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/CompositeFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MergeFilterElement.as
@@ -19,6 +19,9 @@
 package org.apache.royale.svg
 {
 	
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.Event;
 	COMPILE::JS 
 	{
@@ -26,23 +29,22 @@ package org.apache.royale.svg
 	}
 
 	/**
-	 *  The CompositeFilterElement takes two objects and applies Porter/Duff operators
+	 *  The MergeFilterElement merges several filter elements
 	 *  
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class CompositeFilterElement extends FilterElement
+	public class MergeFilterElement extends FilterElement
 	{
-		private var _in2:String;
-		private var _operator:String;
+		private var _strand:IStrand;
+		private var _results:Array;
 
-		public function CompositeFilterElement()
+		public function MergeFilterElement()
 		{
 		}
 		
-		
 		/**
 		 * @royaleignorecoercion Element
 		 */
@@ -51,35 +53,28 @@ package org.apache.royale.svg
 			COMPILE::JS 
 			{
 				super.build();
-				filterElement.setAttribute("in2", in2);
-				filterElement.setAttribute("operator", operator);
+				for (var i:int = 0; i < results.length; i++)
+				{
+					var mergeNode:Element = addSvgElementToElement(filterElement, "feMergeNode") as Element;
+					mergeNode.setAttribute("in", results[i] as String);
+				}
 			}
 		}
 
-		public function get in2():String 
-		{
-			return _in2;
-		}
-		
-		public function set in2(value:String):void 
+		COMPILE::JS
+		override protected function get filterElementType():String
 		{
-			_in2 = value;
+			return "feMerge";
 		}
 
-		public function get operator():String 
+		public function get results():Array 
 		{
-			return _operator;
+			return _results;
 		}
 		
-		public function set operator(value:String):void 
-		{
-			_operator = value;
-		}
-
-		COMPILE::JS
-		override protected function get filterElementType():String
+		public function set results(value:Array):void 
 		{
-			return "feComposite";
+			_results = value;
 		}
 	}
 }
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SuperimposeFilter.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SuperimposeFilter.as
index ecabf26..9c8358a 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SuperimposeFilter.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SuperimposeFilter.as
@@ -37,10 +37,13 @@ package org.apache.royale.svg
 		override protected function filter():void
 		{
 			var newChildren:Array = [];
+			var results:Array = ["SourceGraphic"];
 			for (var i:int = 0; i < children.length; i++)
 			{
 				var chainable:IChainableFilter = children[i] as IChainableFilter;
-				chainable.result = "chainableResult" + i;
+				var resultName:String = "chainableResult" + i;
+				chainable.result = resultName;
+				results.push(resultName);
 				if (i != 0)
 				{
 					chainable.source = "chainableResult" + (i - 1);
@@ -48,6 +51,9 @@ package org.apache.royale.svg
 				chainable.build();
 				addArray(newChildren, chainable.children);
 			}
+			var merge:MergeFilterElement = new MergeFilterElement();
+			merge.results = results;
+			newChildren.push(merge);
 			children = newChildren;
 			super.filter();
 		}


Mime
View raw message