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: Add inset option to DropDownFilter
Date Sun, 08 Jul 2018 13:59:38 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 cec2f2e  Add inset option to DropDownFilter
cec2f2e is described below

commit cec2f2e4ac7d791602a5e50dcd297cb2b7d7791a
Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
AuthorDate: Sun Jul 8 16:59:26 2018 +0300

    Add inset option to DropDownFilter
---
 .../Graphics/src/main/resources/defaults.css       |  2 +
 .../org/apache/royale/svg/DropShadowFilter.as      | 59 +++++++++++++++++-----
 2 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/frameworks/projects/Graphics/src/main/resources/defaults.css b/frameworks/projects/Graphics/src/main/resources/defaults.css
index da97e79..99d45ee 100644
--- a/frameworks/projects/Graphics/src/main/resources/defaults.css
+++ b/frameworks/projects/Graphics/src/main/resources/defaults.css
@@ -44,4 +44,6 @@ svg|DropShadowFilter
 	BlurFilterElement: ClassReference("org.apache.royale.svg.BlurFilterElement");
 	BlendFilterElement: ClassReference("org.apache.royale.svg.BlendFilterElement");
 	SpreadFilterElement: ClassReference("org.apache.royale.svg.SpreadFilterElement");
+	CompositeFilterElement: ClassReference("org.apache.royale.svg.CompositeFilterElement");
+	InvertFilterElement: ClassReference("org.apache.royale.svg.InvertFilterElement");
 }
\ No newline at end of file
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 c9f90bc..dddc808 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
@@ -42,6 +42,7 @@ package org.apache.royale.svg
 		private var _blue:Number = 0;
 		private var _opacity:Number = 1;
 		private var _spread:Number = 1;
+		private var _inset:Boolean;
 
 		public function DropShadowFilter()
 		{
@@ -62,6 +63,10 @@ package org.apache.royale.svg
 				return;
 			}
 			loadBeadFromValuesManager(Filter, "filter", value);
+			if (inset)
+			{
+				loadBeadFromValuesManager(InvertFilterElement, "invertFilterElement", value);
+			}
 			var offset:OffsetFilterElement = loadBeadFromValuesManager(OffsetFilterElement, "offsetFilterElement",
value) as OffsetFilterElement;
 			offset.dx = dx;
 			offset.dy = dy;
@@ -73,11 +78,21 @@ package org.apache.royale.svg
 			colorMatrix.blue = blue;
 			colorMatrix.opacity = opacity;
 			var spreadElement:SpreadFilterElement = loadBeadFromValuesManager(SpreadFilterElement,
"spreadFilterElement", value) as SpreadFilterElement;
-			spreadElement.result = "spreadResult";
+			if (!inset)
+			{
+				spreadElement.result = "spreadResult";
+			}
 			spreadElement.spread = spread;
+			if (inset)
+			{
+				var composite:CompositeFilterElement = loadBeadFromValuesManager(CompositeFilterElement,
"compositeFilterElement", value) as CompositeFilterElement;
+				composite.in2 = "SourceAlpha";
+				composite.operator = "in";
+				composite.result = "compositeResult";
+			}
 			var blend:BlendFilterElement = loadBeadFromValuesManager(BlendFilterElement, "blendFilterElement",
value) as BlendFilterElement;
-			blend.in = "SourceGraphic";
-			blend.in2 = "spreadResult";
+			blend.in = inset ? "compositeResult" : "SourceGraphic";
+			blend.in2 = inset ? "SourceGraphic" : "spreadResult";
 			value.removeBead(this);
 		}
 
@@ -88,16 +103,16 @@ package org.apache.royale.svg
 			if (c)
 			{
 				COMPILE::JS
-					{
-						var f:Function = c as Function;
-						result = new f() as IBead;
-					}
-					COMPILE::SWF
-					{
-						result = new c() as IBead;
-					}
-					if (result)
-						strand.addBead(result);
+				{
+				var f:Function = c as Function;
+					result = new f() as IBead;
+				}
+				COMPILE::SWF
+				{
+					result = new c() as IBead;
+				}
+				if (result)
+					strand.addBead(result);
 			}
 			return result;
 		}
@@ -245,6 +260,24 @@ package org.apache.royale.svg
 		{
 			_spread = value;
 		}
+
+		/**
+		 *  Whether or not the drop shadow is inset.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.3
+		 */
+		public function get inset():Boolean 
+		{
+			return _inset;
+		}
+		
+		public function set inset(value:Boolean):void 
+		{
+			_inset = value;
+		}
 	}
 }
 


Mime
View raw message