You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2018/09/03 09:16:26 UTC

[royale-asjs] 04/13: Filter elements are now children of filter bead instead of beads.

This is an automated email from the ASF dual-hosted git repository.

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

commit 11971b24e0933af95d113db062b54675fd4ac523
Author: DESKTOP-RH4S838\Yishay <yi...@hotmail.com>
AuthorDate: Sun Jul 15 10:44:59 2018 +0300

    Filter elements are now children of filter bead instead of beads.
---
 .../org/apache/royale/svg/BlendFilterElement.as    | 14 +++++++------
 .../org/apache/royale/svg/BlurFilterElement.as     | 10 ++++++----
 .../apache/royale/svg/ColorMatrixFilterElement.as  | 12 ++++++-----
 .../apache/royale/svg/CompositeFilterElement.as    | 12 ++++++-----
 .../main/royale/org/apache/royale/svg/Filter.as    | 23 +++++++++++++++++-----
 .../royale/org/apache/royale/svg/FilterElement.as  | 16 ++++++++-------
 .../org/apache/royale/svg/InvertFilterElement.as   | 16 ++++++++-------
 .../org/apache/royale/svg/OffsetFilterElement.as   | 12 ++++++-----
 .../org/apache/royale/svg/SpreadFilterElement.as   | 14 +++++++------
 9 files changed, 79 insertions(+), 50 deletions(-)

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 ecbac1d..6c4eac3 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
@@ -49,13 +49,15 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPILE::JS 
-		override protected function build():void
+		override public function build():void
 		{
-			super.build();
-			filterElement.setAttribute("in", in);
-			filterElement.setAttribute("in2", in2);
-			filterElement.setAttribute("mode", "normal");
+			COMPILE::JS 
+			{
+				super.build();
+				filterElement.setAttribute("in", in);
+				filterElement.setAttribute("in2", in2);
+				filterElement.setAttribute("mode", "normal");
+			}
 		}
 
 		/**
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlurFilterElement.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlurFilterElement.as
index fdfe358..e4ba5b6 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlurFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/BlurFilterElement.as
@@ -45,11 +45,13 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPILE::JS 
-		override protected function build():void
+		override public function build():void
 		{
-			super.build();
-			filterElement.setAttribute("stdDeviation", stdDeviation);
+			COMPILE::JS 
+			{
+				super.build();
+				filterElement.setAttribute("stdDeviation", stdDeviation);
+			}
 		}
 
 		/**
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/ColorMatrixFilterElement.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/ColorMatrixFilterElement.as
index 89b460b..8e3a1f1 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/ColorMatrixFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/ColorMatrixFilterElement.as
@@ -49,12 +49,14 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPILE::JS 
-		override protected function build():void
+		override public function build():void
 		{
-			super.build();
-			var matrixValues:String = "0 0 0 0 " + red + " 0 0 0 0 " + green + " 0 0 0 0 " + blue + " 0 0 0 " + opacity + " 0";
-			filterElement.setAttribute("values", matrixValues);
+			COMPILE::JS 
+			{
+				super.build();
+				var matrixValues:String = "0 0 0 0 " + red + " 0 0 0 0 " + green + " 0 0 0 0 " + blue + " 0 0 0 " + opacity + " 0";
+				filterElement.setAttribute("values", matrixValues);
+			}
 		}
 
 		/**
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 fa84244..a01ce4b 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
@@ -46,12 +46,14 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPILE::JS 
-		override protected function build():void
+		override public function build():void
 		{
-			super.build();
-			filterElement.setAttribute("in2", in2);
-			filterElement.setAttribute("operator", operator);
+			COMPILE::JS 
+			{
+				super.build();
+				filterElement.setAttribute("in2", in2);
+				filterElement.setAttribute("operator", operator);
+			}
 		}
 
 		public function get in2():String 
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/Filter.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/Filter.as
index e58bc70..ffc17f1 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/Filter.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/Filter.as
@@ -19,16 +19,17 @@
 package org.apache.royale.svg
 {
 	
-	import org.apache.royale.core.IBead;
-	import org.apache.royale.core.IRenderedObject;
-	import org.apache.royale.core.IStrand;
-
 	COMPILE::JS
 	{
 		import org.apache.royale.utils.UIDUtil;
 		import org.apache.royale.graphics.utils.addSvgElementToElement;
 		import org.apache.royale.events.IEventDispatcher;
 	}
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IRenderedObject;
+	import org.apache.royale.core.IStrand;
+	[DefaultProperty("children")]
+
 	/**
 	 *  The Filter bead allows you to filter an SVG element. Filter elements should be added to the strand to achieve the desired effect.
 	 *  
@@ -42,6 +43,7 @@ package org.apache.royale.svg
 		private var _strand:IStrand;
 		private var _width:String = "200%";
 		private var _height:String = "200%";
+		private var _children:Array;
 //		private var floodColor:uint;
 		COMPILE::JS 
 		{
@@ -112,7 +114,8 @@ package org.apache.royale.svg
 			for (var i:int = 0; i < children.length; i++)
 			{
 				var filterElement:FilterElement = children[i] as FilterElement;
-				filterElement.buildOn(filterElementWrapper);
+				filterElement.filterElementWrapper = filterElementWrapper;
+				filterElement.build();
 			}
 		}
 		
@@ -154,6 +157,16 @@ package org.apache.royale.svg
 		{
 			return _filterElementWrapper;
 		}
+
+		public function get children():Array 
+		{
+			return _children;
+		}
+		
+		public function set children(value:Array):void 
+		{
+			_children = 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 6afb656..0e7e1fd 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
@@ -53,13 +53,15 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPILE::JS 
-		protected function build():void
+		public function build():void
 		{
-			_filterElement = addSvgElementToElement(filterElementWrapper, filterElementType) as Element;
-			if (result)
+			COMPILE::JS 
 			{
-				filterElement.setAttribute("result", result);
+				_filterElement = addSvgElementToElement(filterElementWrapper, filterElementType) as Element;
+				if (result)
+				{
+					filterElement.setAttribute("result", result);
+				}
 			}
 		}
 		
@@ -100,7 +102,7 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPIE::JS
+		COMPILE::JS
 		public function get filterElementWrapper():Element 
 		{
 			return _filterElementWrapper;
@@ -109,7 +111,7 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPIE::JS
+		COMPILE::JS
 		public function set filterElementWrapper(value:Element):void 
 		{
 			_filterElementWrapper = value;
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/InvertFilterElement.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/InvertFilterElement.as
index 3ba808a..7d0958a 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/InvertFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/InvertFilterElement.as
@@ -45,14 +45,16 @@ package org.apache.royale.svg
 		/*
 		* @royaleignorecoercion Element
 		*/
-		COMPILE::JS 
-		override protected function build():void
+		override public function build():void
 		{
-			super.build();
-			filterElement.setAttribute("in", "SourceAlpha");
-			var funcA:Element = addSvgElementToElement(filterElement, "feFuncA") as Element;
-			funcA.setAttribute("type", "table");
-			funcA.setAttribute("tableValues", "1 0");
+			COMPILE::JS 
+			{
+				super.build();
+				filterElement.setAttribute("in", "SourceAlpha");
+				var funcA:Element = addSvgElementToElement(filterElement, "feFuncA") as Element;
+				funcA.setAttribute("type", "table");
+				funcA.setAttribute("tableValues", "1 0");
+			}
 		}
 			
 		COMPILE::JS
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/OffsetFilterElement.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/OffsetFilterElement.as
index 1ace625..6d76227 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/OffsetFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/OffsetFilterElement.as
@@ -46,12 +46,14 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPILE::JS 
-		override protected function build():void
+		override public function build():void
 		{
-			super.build();
-			filterElement.setAttribute("dx", dx);
-			filterElement.setAttribute("dy", dy);
+			COMPILE::JS 
+			{
+				super.build();
+				filterElement.setAttribute("dx", dx);
+				filterElement.setAttribute("dy", dy);
+			}
 		}
 
 		/**
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SpreadFilterElement.as b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SpreadFilterElement.as
index 44786ec..57453e3 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SpreadFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/SpreadFilterElement.as
@@ -45,13 +45,15 @@ package org.apache.royale.svg
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		COMPILE::JS 
-		override protected function build():void
+		override public function build():void
 		{
-			super.build();
-			var funcA:Element = addSvgElementToElement(filterElement, "feFuncA") as Element;
-			funcA.setAttribute("type", "linear");
-			funcA.setAttribute("slope", spread);
+			COMPILE::JS 
+			{
+				super.build();
+				var funcA:Element = addSvgElementToElement(filterElement, "feFuncA") as Element;
+				funcA.setAttribute("type", "linear");
+				funcA.setAttribute("slope", spread);
+			}
 		}
 
 		/**