royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject [royale-asjs] 02/02: Refactoring filter element, some common functioalities are now in a base class.
Date Sun, 08 Jul 2018 10:16:06 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

commit 396393daafeb69bdfd5db06619ffdd9b9092482b
Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
AuthorDate: Sun Jul 8 13:15:20 2018 +0300

    Refactoring filter element, some common functioalities are now in a base
    class.
---
 .../org/apache/royale/svg/BlurFilterElement.as     | 48 ++------------
 .../apache/royale/svg/ColorMatrixFilterElement.as  | 59 ++++-------------
 .../apache/royale/svg/CompositeFilterElement.as    | 52 +++------------
 .../org/apache/royale/svg/DropShadowFilter.as      |  6 +-
 ...{CompositeFilterElement.as => FilterElement.as} | 75 +++++++++++-----------
 .../org/apache/royale/svg/InvertFilterElement.as   | 42 +++++-------
 .../org/apache/royale/svg/MergeFilterElement.as    | 40 ++++--------
 .../org/apache/royale/svg/OffsetFilterElement.as   | 64 +++---------------
 .../org/apache/royale/svg/SpreadFilterElement.as   | 69 ++------------------
 9 files changed, 111 insertions(+), 344 deletions(-)

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 d69f264..14ba372 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
@@ -19,10 +19,6 @@
 package org.apache.royale.svg
 {
 	
-	import org.apache.royale.core.IBead;
-	import org.apache.royale.core.IRenderedObject;
-	import org.apache.royale.core.IStrand;
-	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.Event;
 	COMPILE::JS 
 	{
@@ -37,41 +33,24 @@ package org.apache.royale.svg
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class BlurFilterElement implements IBead
+	public class BlurFilterElement extends FilterElement
 	{
-		private var _strand:IStrand;
 		private var _stdDeviation:Number = 3;
-		private var _blurResult:String = "blurResult";
 
 		public function BlurFilterElement()
 		{
 		}
 		
-		/**
-		 *  @copy org.apache.royale.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */		
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			(_strand as IEventDispatcher).addEventListener('beadsAdded', onInitComplete);
-		}
 		
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		protected function onInitComplete(e:Event):void
+		override protected function onInitComplete(e:Event):void
 		{
+			super.onInitComplete(e);
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var offset:Element = addSvgElementToElement(filter, "feGaussianBlur") as Element;
-				offset.setAttribute("stdDeviation", stdDeviation);
-				offset.setAttribute("result", blurResult);
+				filterElement.setAttribute("stdDeviation", stdDeviation);
 			}
 		}
 
@@ -93,25 +72,12 @@ package org.apache.royale.svg
 			_stdDeviation = value;
 		}
 
-		/**
-		 *  Where to write the result of this filter. 
-		 *  This is useful for using the result as a source for another filter element.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */
-		public function get blurResult():String
-		{
-			return _blurResult;
-		}
 
-		public function set blurResult(value:String):void
+		COMPILE::JS
+		override protected function get filterElementType():String
 		{
-			_blurResult = value;
+			return "feGaussianBlur";
 		}
-
 	}
 }
 
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 15b22ad..5e38562 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
@@ -19,10 +19,6 @@
 package org.apache.royale.svg
 {
 	
-	import org.apache.royale.core.IBead;
-	import org.apache.royale.core.IRenderedObject;
-	import org.apache.royale.core.IStrand;
-	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.Event;
 	COMPILE::JS 
 	{
@@ -37,47 +33,29 @@ package org.apache.royale.svg
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class ColorMatrixFilterElement implements IBead
+	public class ColorMatrixFilterElement extends FilterElement
 	{
-		private var _strand:IStrand;
-		private var _in1:String = "SourceGraphic";
 		private var _red:Number = 0;
 		private var _green:Number = 0;
 		private var _blue:Number = 0;
 		private var _opacity:Number = 1;
-		private var _colorMatrixResult:String = "colorMatrixResult";
+		private var _filterElementResult:String = "filterElementResult";
 
 		public function ColorMatrixFilterElement()
 		{
 		}
 		
-		/**
-		 *  @copy org.apache.royale.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */		
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			(_strand as IEventDispatcher).addEventListener('beadsAdded', onInitComplete);
-		}
 		
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		protected function onInitComplete(e:Event):void
+		override protected function onInitComplete(e:Event):void
 		{
+			super.onInitComplete(e);
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var colorMatrix:Element = addSvgElementToElement(filter, "feColorMatrix") as Element;
 				var matrixValues:String = "0 0 0 0 " + red / 255 + " 0 0 0 0 " + green  / 255 + " 0 0
0 0 " + blue / 255 + " 0 0 0 " + opacity + " 0";
-				colorMatrix.setAttribute("values", matrixValues);
-				colorMatrix.setAttribute("in1", in1);
-				colorMatrix.setAttribute("result", colorMatrixResult);
+				filterElement.setAttribute("values", matrixValues);
 			}
 		}
 
@@ -162,34 +140,21 @@ package org.apache.royale.svg
 		 *  @playerversion AIR 2.6
 		 *  @productversion Royale 0.9.3
 		 */
-		public function get colorMatrixResult():String
-		{
-			return _colorMatrixResult;
-		}
-
-		public function set colorMatrixResult(value:String):void
+		public function get filterElementResult():String
 		{
-			_colorMatrixResult = value;
+			return _filterElementResult;
 		}
 
-		/**
-		 *  The source for this filter element
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */
-		public function get in1():String
+		public function set filterElementResult(value:String):void
 		{
-			return _in1;
+			_filterElementResult = value;
 		}
 
-		public function set in1(value:String):void
+		COMPILE::JS
+		override protected function get filterElementType():String
 		{
-			_in1 = value;
+			return "feColorMatrix";
 		}
-
 	}
 }
 
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 00da207..94dd7d1 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
@@ -19,9 +19,6 @@
 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 
 	{
@@ -36,58 +33,29 @@ package org.apache.royale.svg
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class CompositeFilterElement implements IBead
+	public class CompositeFilterElement extends FilterElement
 	{
-		private var _strand:IStrand;
-		private var _in:String;
 		private var _in2:String;
-		private var _result:String;
 		private var _operator:String;
 
 		public function CompositeFilterElement()
 		{
 		}
 		
-		/**
-		 *  @copy org.apache.royale.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */		
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			(_strand as IEventDispatcher).addEventListener('beadsAdded', onInitComplete);
-		}
 		
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		protected function onInitComplete(e:Event):void
+		override protected function onInitComplete(e:Event):void
 		{
+			super.onInitComplete(e);
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var compositeElement:Element = addSvgElementToElement(filter, "feComposite") as Element;
-				compositeElement.setAttribute("in", in);
-				compositeElement.setAttribute("in2", in2);
-				compositeElement.setAttribute("result", result);
-				compositeElement.setAttribute("operator", operator);
+				filterElement.setAttribute("in2", in2);
+				filterElement.setAttribute("operator", operator);
 			}
 		}
 
-		public function get in():String 
-		{
-			return _in;
-		}
-		
-		public function set in(value:String):void 
-		{
-			_in = value;
-		}
-
 		public function get in2():String 
 		{
 			return _in2;
@@ -108,14 +76,10 @@ package org.apache.royale.svg
 			_operator = value;
 		}
 
-		public function get result():String 
-		{
-			return _result;
-		}
-		
-		public function set result(value:String):void 
+		COMPILE::JS
+		override protected function get filterElementType():String
 		{
-			_result = value;
+			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 2132ff6..e297773 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
@@ -67,17 +67,13 @@ package org.apache.royale.svg
 			offset.dy = dy;
 			var blur:BlurFilterElement = loadBeadFromValuesManager(BlurFilterElement, "blurFilterElement",
value) as BlurFilterElement;
 			blur.stdDeviation = stdDeviation;
-			blur.blurResult = "blurResult";
 			var colorMatrix:ColorMatrixFilterElement = loadBeadFromValuesManager(ColorMatrixFilterElement,
"colorMatrixFilterElement", value) as ColorMatrixFilterElement;
-			colorMatrix.in1 = "blurResult";
 			colorMatrix.red = red;
 			colorMatrix.green = green;
 			colorMatrix.blue = blue;
 			colorMatrix.opacity = opacity;
-			colorMatrix.colorMatrixResult = "colorMatrixResult";
 			var spreadElement:SpreadFilterElement = loadBeadFromValuesManager(SpreadFilterElement,
"spreadFilterElement", value) as SpreadFilterElement;
-			spreadElement.in1 = "colorMatrixResult";
-			spreadElement.spreadResult = "spreadResult";
+			spreadElement.result = "spreadResult";
 			spreadElement.spread = spread;
 			var blend:BlendFilterElement = loadBeadFromValuesManager(BlendFilterElement, "blendFilterElement",
value) as BlendFilterElement;
 			blend.in2 = "spreadResult";
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/FilterElement.as
similarity index 66%
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/FilterElement.as
index 00da207..86137fd 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/FilterElement.as
@@ -29,22 +29,23 @@ package org.apache.royale.svg
 	}
 
 	/**
-	 *  The CompositeFilterElement takes two objects and applies Porter/Duff operators
+	 *  FilterElement abstracts some methods and vars for elements that can go in an SVG filter
 	 *  
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class CompositeFilterElement implements IBead
+	public class FilterElement implements IBead
 	{
 		private var _strand:IStrand;
-		private var _in:String;
-		private var _in2:String;
 		private var _result:String;
-		private var _operator:String;
+		COMPILE::JS
+		{
+			private var _filterElement:Element;
+		}
 
-		public function CompositeFilterElement()
+		public function FilterElement()
 		{
 		}
 		
@@ -69,53 +70,53 @@ package org.apache.royale.svg
 		{
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var compositeElement:Element = addSvgElementToElement(filter, "feComposite") as Element;
-				compositeElement.setAttribute("in", in);
-				compositeElement.setAttribute("in2", in2);
-				compositeElement.setAttribute("result", result);
-				compositeElement.setAttribute("operator", operator);
+				var filter:Element = getFilterElementWrapper();
+				_filterElement = addSvgElementToElement(filter, filterElementType) as Element;
+				filterElement.setAttribute("result", result);
 			}
 		}
-
-		public function get in():String 
-		{
-			return _in;
-		}
 		
-		public function set in(value:String):void 
+		/**
+		 * @royaleignorecoercion Element
+		 */
+		COMPILE::JS
+		protected function getFilterElementWrapper():Element
 		{
-			_in = value;
+			return (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
 		}
 
-		public function get in2():String 
+		/**
+		 *  Reference to the filter element result. This can later be used as input for a subsequent
filter element.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.3
+		 */
+		public function get result():String 
 		{
-			return _in2;
+			return _result;
 		}
 		
-		public function set in2(value:String):void 
-		{
-			_in2 = value;
-		}
-
-		public function get operator():String 
+		public function set result(value:String):void 
 		{
-			return _operator;
+			_result = value;
 		}
 		
-		public function set operator(value:String):void 
-		{
-			_operator = value;
-		}
-
-		public function get result():String 
+		COMPILE::JS
+		protected function get filterElementType():String
 		{
-			return _result;
+			// override this
+			return "";
 		}
 		
-		public function set result(value:String):void 
+		/**
+		 * @royaleignorecoercion Element
+		 */
+		COMPILE::JS
+		protected function get filterElement():Element
 		{
-			_result = value;
+			return _filterElement;
 		}
 	}
 }
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 a2cd104..ae37052 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
@@ -20,7 +20,6 @@ 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 
@@ -36,44 +35,33 @@ package org.apache.royale.svg
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class InvertFilterElement implements IBead
+	public class InvertFilterElement extends FilterElement
 	{
-		private var _strand:IStrand;
-
-		public function InvertFilterElement()
-		{
-		}
 		
-		/**
-		 *  @copy org.apache.royale.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */		
-		public function set strand(value:IStrand):void
+		public function InvertFilterElement()
 		{
-			_strand = value;
-			(_strand as IEventDispatcher).addEventListener('beadsAdded', onInitComplete);
 		}
 		
-		/**
-		 * @royaleignorecoercion Element
-		 */
-		protected function onInitComplete(e:Event):void
+		/*
+		* @royaleignorecoercion Element
+		*/
+		override protected function onInitComplete(e:Event):void
 		{
+			super.onInitComplete(e);
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var componentTransfer:Element = addSvgElementToElement(filter, "feComponentTransfer")
as Element;
-				componentTransfer.setAttribute("in", "SourceAlpha");
-				var funcA:Element = addSvgElementToElement(componentTransfer, "feFuncA") as Element;
+				filterElement.setAttribute("in", "SourceAlpha");
+				var funcA:Element = addSvgElementToElement(filterElement, "feFuncA") as Element;
 				funcA.setAttribute("type", "table");
 				funcA.setAttribute("tableValues", "1 0");
 			}
 		}
-
+			
+		COMPILE::JS
+		override protected function get filterElementType():String
+		{
+			return "feComponentTransfer";
+		}
 	}
 }
 
diff --git a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MergeFilterElement.as
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MergeFilterElement.as
index 655242c..1be51fa 100644
--- a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MergeFilterElement.as
+++ b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/MergeFilterElement.as
@@ -19,9 +19,6 @@
 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 
 	{
@@ -29,53 +26,38 @@ package org.apache.royale.svg
 	}
 
 	/**
-	 *  The BlendFilterElement blends several filter elements
+	 *  The BlendFilterElement filterElements several filter elements
 	 *  
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class BlendFilterElement implements IBead
+	public class BlendFilterElement extends FilterElement
 	{
-		private var _strand:IStrand;
 		private var _in2:String;
 
 		public function BlendFilterElement()
 		{
 		}
 		
-		/**
-		 *  @copy org.apache.royale.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */		
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			(_strand as IEventDispatcher).addEventListener('beadsAdded', onInitComplete);
-		}
 		
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		protected function onInitComplete(e:Event):void
+		override protected function onInitComplete(e:Event):void
 		{
+			super.onInitComplete(e);
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var blend:Element = addSvgElementToElement(filter, "feBlend") as Element;
-				blend.setAttribute("in", "SourceGraphic");
-				blend.setAttribute("in2", in2);
-				blend.setAttribute("mode", "normal");
+				filterElement.setAttribute("in", "SourceGraphic");
+				filterElement.setAttribute("in2", in2);
+				filterElement.setAttribute("mode", "normal");
 			}
 		}
 
 		/**
-		 *  The filter element result which is blended with the source graphic.
+		 *  The filter element result which is filterElemented with the source graphic.
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
@@ -91,6 +73,12 @@ package org.apache.royale.svg
 		{
 			_in2 = value;
 		}
+
+		COMPILE::JS
+		override protected function get filterElementType():String
+		{
+			return "feBlend";
+		}
 	}
 }
 
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 7f4d9b6..56ed0bc 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
@@ -19,10 +19,6 @@
 package org.apache.royale.svg
 {
 	
-	import org.apache.royale.core.IBead;
-	import org.apache.royale.core.IRenderedObject;
-	import org.apache.royale.core.IStrand;
-	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.Event;
 	COMPILE::JS 
 	{
@@ -30,52 +26,33 @@ package org.apache.royale.svg
 	}
 
 	/**
-	 *  The OffsetFilterElement bead adds an offset to a filtered SVG element
+	 *  The OffsetFilterElement bead adds an filterElement to a filtered SVG element
 	 *  
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class OffsetFilterElement implements IBead
+	public class OffsetFilterElement extends FilterElement
 	{
-		private var _strand:IStrand;
 		private var _dx:Number = 0;
 		private var _dy:Number = 0;
-		private var _in:String;
-		private var _offsetResult:String = "offsetResult";
 
 		public function OffsetFilterElement()
 		{
 		}
 		
-		/**
-		 *  @copy org.apache.royale.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */		
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			(_strand as IEventDispatcher).addEventListener('beadsAdded', onInitComplete);
-		}
 		
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		protected function onInitComplete(e:Event):void
+		override protected function onInitComplete(e:Event):void
 		{
+			super.onInitComplete(e);
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var offset:Element = addSvgElementToElement(filter, "feOffset") as Element;
-				offset.setAttribute("dx", dx);
-				offset.setAttribute("dy", dy);
-//				offset.setAttribute("in", in);
-				offset.setAttribute("result", offsetResult);
+				filterElement.setAttribute("dx", dx);
+				filterElement.setAttribute("dy", dy);
 			}
 		}
 
@@ -114,34 +91,11 @@ package org.apache.royale.svg
 		{
 			_dy = value;
 		}
-
-		/**
-		 *  Where to write the result of this filter. 
-		 *  This is useful for using the result as a source for another filter element.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */
-		public function get offsetResult():String
-		{
-			return _offsetResult;
-		}
-
-		public function set offsetResult(value:String):void
-		{
-			_offsetResult = value;
-		}
-
-		public function get in():String  
-		{
-			return _in;
-		}
 		
-		public function set in(value:String ):void 
+		COMPILE::JS
+		override protected function get filterElementType():String
 		{
-			_in = value;
+			return "feOffset";
 		}
 	}
 }
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 b3a6559..edc414b 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
@@ -19,10 +19,6 @@
 package org.apache.royale.svg
 {
 	
-	import org.apache.royale.core.IBead;
-	import org.apache.royale.core.IRenderedObject;
-	import org.apache.royale.core.IStrand;
-	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.Event;
 	COMPILE::JS 
 	{
@@ -37,45 +33,26 @@ package org.apache.royale.svg
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class SpreadFilterElement implements IBead
+	public class SpreadFilterElement extends FilterElement
 	{
-		private var _strand:IStrand;
-		private var _in1:String = "SourceGraphic";
 		private var _spread:Number = 1.0;
-		private var _spreadResult:String = "spreadResult";
 
 		public function SpreadFilterElement()
 		{
 		}
 		
-		/**
-		 *  @copy org.apache.royale.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */		
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			(_strand as IEventDispatcher).addEventListener('beadsAdded', onInitComplete);
-		}
 		
 		/**
 		 * @royaleignorecoercion Element
 		 */
-		protected function onInitComplete(e:Event):void
+		override protected function onInitComplete(e:Event):void
 		{
+			super.onInitComplete(e);
 			COMPILE::JS 
 			{
-				var filter:Element = (_strand.getBeadByType(Filter) as Filter).filterElementWrapper;
-				var componentTransfer:Element = addSvgElementToElement(filter, "feComponentTransfer")
as Element;
-				var funcA:Element = addSvgElementToElement(componentTransfer, "feFuncA") as Element;
+				var funcA:Element = addSvgElementToElement(filterElement, "feFuncA") as Element;
 				funcA.setAttribute("type", "linear");
 				funcA.setAttribute("slope", spread);
-				componentTransfer.setAttribute("in1", in1);
-				componentTransfer.setAttribute("result", spreadResult);
 			}
 		}
 
@@ -97,43 +74,11 @@ package org.apache.royale.svg
 			_spread = value;
 		}
 
-		/**
-		 *  Where to write the result of this filter. 
-		 *  This is useful for using the result as a source for another filter element.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */
-		public function get spreadResult():String
+		COMPILE::JS
+		override protected function get filterElementType():String
 		{
-			return _spreadResult;
+			return "feComponentTransfer";
 		}
-
-		public function set spreadResult(value:String):void
-		{
-			_spreadResult = value;
-		}
-
-		/**
-		 *  The source for this filter element
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */
-		public function get in1():String
-		{
-			return _in1;
-		}
-
-		public function set in1(value:String):void
-		{
-			_in1 = value;
-		}
-
 	}
 }
 


Mime
View raw message