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 412ed7650795c7741b50e522a3f05573e5b0d213
Author: DESKTOP-RH4S838\Yishay <[email protected]>
AuthorDate: Tue Jul 3 12:32:14 2018 +0300

    Adding first version of ColorMatrixFilterElement
---
 .../Graphics/src/main/resources/svg-manifest.xml   |   1 +
 .../apache/royale/svg/ColorMatrixFilterElement.as  | 195 +++++++++++++++++++++
 2 files changed, 196 insertions(+)

diff --git a/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml 
b/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
index 9587809..eb25381 100644
--- a/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
+++ b/frameworks/projects/Graphics/src/main/resources/svg-manifest.xml
@@ -25,6 +25,7 @@
        <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="ColorMatrixFilterElement" 
class="org.apache.royale.svg.ColorMatrixFilterElement" />
        <component id="BlurFilterElement" 
class="org.apache.royale.svg.BlurFilterElement" />
        <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/ColorMatrixFilterElement.as
 
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/ColorMatrixFilterElement.as
new file mode 100644
index 0000000..15b22ad
--- /dev/null
+++ 
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/svg/ColorMatrixFilterElement.as
@@ -0,0 +1,195 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.IRenderedObject;
+       import org.apache.royale.core.IStrand;
+       import org.apache.royale.events.IEventDispatcher;
+       import org.apache.royale.events.Event;
+       COMPILE::JS 
+       {
+               import org.apache.royale.graphics.utils.addSvgElementToElement;
+       }
+
+       /**
+        *  The ColorMatrixFilterElement bead adds an offset to a filtered SVG 
element
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9.3
+        */
+       public class ColorMatrixFilterElement implements IBead
+       {
+               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";
+
+               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
+               {
+                       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);
+                       }
+               }
+
+               /**
+                *  The red value
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+               public function get red():Number
+               {
+                       return _red;
+               }
+
+               public function set red(value:Number):void
+               {
+                       _red = value;
+               }
+
+               /**
+                *  The blue value
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+               public function get blue():Number
+               {
+                       return _blue;
+               }
+
+               public function set blue(value:Number):void
+               {
+                       _blue = value;
+               }
+
+               /**
+                *  The green value
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+               public function get green():Number
+               {
+                       return _green;
+               }
+
+               public function set green(value:Number):void
+               {
+                       _green = value;
+               }
+
+               /**
+                *  The opacity value
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+               public function get opacity():Number
+               {
+                       return _opacity;
+               }
+
+               public function set opacity(value:Number):void
+               {
+                       _opacity = 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 colorMatrixResult():String
+               {
+                       return _colorMatrixResult;
+               }
+
+               public function set colorMatrixResult(value:String):void
+               {
+                       _colorMatrixResult = 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;
+               }
+
+       }
+}
+

Reply via email to