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

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

commit e254355c37f133e0605cb52e8320273784e9fa2b
Author: DESKTOP-RH4S838\Yishay <[email protected]>
AuthorDate: Tue Jul 3 08:36:20 2018 +0300

    Add DropShadowFilter bead which is a convenience bead that adds a series
    of beads and initiailized them.
---
 .../Graphics/src/main/resources/defaults.css       |   8 ++
 .../Graphics/src/main/resources/svg-manifest.xml   |   2 +-
 .../org/apache/royale/svg/DropShadowFilter.as      | 126 +++++++++++++++++++++
 3 files changed, 135 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/Graphics/src/main/resources/defaults.css 
b/frameworks/projects/Graphics/src/main/resources/defaults.css
index 42b61ee..a0faaca 100644
--- a/frameworks/projects/Graphics/src/main/resources/defaults.css
+++ b/frameworks/projects/Graphics/src/main/resources/defaults.css
@@ -35,3 +35,11 @@ svg|BinaryImage
        IBinaryImageLoader: 
ClassReference("org.apache.royale.html.beads.BinaryImageLoader");
 }
 
+svg|DropShadowFilter
+{
+       Filter: ClassReference("org.apache.royale.svg.Filter");
+       BlendFilterElement: 
ClassReference("org.apache.royale.svg.BlendFilterElement");
+       OffsetFilterElement: 
ClassReference("org.apache.royale.svg.OffsetFilterElement");
+       BlurFilterElement: 
ClassReference("org.apache.royale.svg.BlurFilterElement");
+       BlendFilterElement: 
ClassReference("org.apache.royale.svg.BlendFilterElement");
+}
\ No newline at end of file
diff --git a/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml 
b/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
index 4c95d2f..9587809 100644
--- a/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
+++ b/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
@@ -22,6 +22,7 @@
 <componentPackage>
        <component id="TransformBead" 
class="org.apache.royale.svg.TransformBead" />
        <component id="ClipBead" class="org.apache.royale.svg.ClipBead" />
+       <component id="DropShadowFilter" 
class="org.apache.royale.svg.DropShadowFilter" />
        <component id="Filter" class="org.apache.royale.svg.Filter" />
        <component id="OffsetFilterElement" 
class="org.apache.royale.svg.OffsetFilterElement" />
        <component id="BlurFilterElement" 
class="org.apache.royale.svg.BlurFilterElement" />
@@ -29,5 +30,4 @@
        <component id="MaskBead" class="org.apache.royale.svg.MaskBead" />
        <component id="DisableClipBead" 
class="org.apache.royale.svg.DisableClipBead" />
        <component id="LinearGradient" 
class="org.apache.royale.svg.LinearGradient" />
-       
 </componentPackage>
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
new file mode 100644
index 0000000..f3a0b32
--- /dev/null
+++ 
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/DropShadowFilter.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.svg
+{
+       
+       import org.apache.royale.core.IBead;
+       import org.apache.royale.core.IStrand;
+       import org.apache.royale.core.ValuesManager;
+
+       /**
+        *  DropShadowFilter is a bead that injects a series of beads in the 
correct 
+        *  order and initialized them.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9.3
+        */
+       public class DropShadowFilter implements IBead
+       {
+               private var _dx:Number;
+               private var _dy:Number;
+               private var _stdDeviation:Number;
+
+               public function DropShadowFilter()
+               {
+               }
+               
+               /**
+                *  @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
+               {
+                       if (!value)
+                       {
+                               return;
+                       }
+                       loadBeadFromValuesManager(Filter, "filter", value);
+                       var offset:OffsetFilterElement = 
loadBeadFromValuesManager(OffsetFilterElement, "offsetFilterElement", value) as 
OffsetFilterElement;
+                       offset.dx = dx;
+                       offset.dy = dy;
+                       var blur:BlurFilterElement = 
loadBeadFromValuesManager(BlurFilterElement, "blurFilterElement", value) as 
BlurFilterElement;
+                       blur.stdDeviation = stdDeviation;
+                       blur.blurResult = "blurResult";
+                       var blend:BlendFilterElement = 
loadBeadFromValuesManager(BlendFilterElement, "blendFilterElement", value) as 
BlendFilterElement;
+                       blend.in2 = "blurResult";
+                       value.removeBead(this);
+               }
+
+               public function 
loadBeadFromValuesManager(classOrInterface:Class, classOrInterfaceName:String, 
strand:IStrand):IBead
+               {
+                       var result:IBead = 
strand.getBeadByType(classOrInterface);
+                       if (!result)
+                       {
+                               var c:Class = 
ValuesManager.valuesImpl.getValue(this, classOrInterfaceName) as Class;
+                               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);
+                               }
+                       }
+                       return result;
+               }
+
+               public function get dx():Number
+               {
+                       return _dx;
+               }
+               
+               public function set dx(value:Number):void
+               {
+                       _dx = value;
+               }
+               
+               public function get dy():Number
+               {
+                       return _dy;
+               }
+               
+               public function set dy(value:Number):void
+               {
+                       _dy = value;
+               }
+
+               public function get stdDeviation():Number
+               {
+                       return _stdDeviation;
+               }
+               
+               public function set stdDeviation(value:Number):void
+               {
+                       _stdDeviation = value;
+               }
+       }
+}
+

Reply via email to