You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2020/09/25 12:27:36 UTC
[royale-asjs] 04/09: Adding some spark filter dependency stubs
This is an automated email from the ASF dual-hosted git repository.
yishayw pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 8a3bb0ee0d4cce7d4dcce581ec46974ed333c79b
Author: Yishay Weiss <yi...@yell.com>
AuthorDate: Fri Sep 25 10:09:59 2020 +0100
Adding some spark filter dependency stubs
---
.../main/royale/mx/filters/BaseDimensionFilter.as | 235 +++++++++++++++++++++
.../src/main/royale/mx/filters/BaseFilter.as | 76 +++++++
.../src/main/royale/mx/filters/IBitmapFilter.as | 48 +++++
.../src/main/royale/spark/filters/GlowFilter.as | 9 +-
4 files changed, 364 insertions(+), 4 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/filters/BaseDimensionFilter.as b/frameworks/projects/MXRoyale/src/main/royale/mx/filters/BaseDimensionFilter.as
new file mode 100644
index 0000000..f50a0b4
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/filters/BaseDimensionFilter.as
@@ -0,0 +1,235 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.filters
+{
+import org.apache.royale.events.IEventDispatcher;
+
+/**
+ * Base class for some Spark filters.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+public class BaseDimensionFilter extends BaseFilter
+{
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function BaseDimensionFilter()
+ {
+ super();
+ }
+
+ //----------------------------------
+ // blurX
+ //----------------------------------
+
+ private var _blurX:Number = 4.0;
+
+ [Inspectable(minValue="0.0", maxValue="255.0")]
+
+ /**
+ * The amount of horizontal blur. Valid values are 0 to 255. A blur of 1
+ * or less means that the original image is copied as is. The default
+ * value is 4. Values that are a power of 2 (such as 2, 4, 8, 16, and 32)
+ * are optimized to render more quickly than other values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get blurX():Number
+ {
+ return _blurX;
+ }
+
+ /**
+ * @private
+ */
+ public function set blurX(value:Number):void
+ {
+ if (value != _blurX)
+ {
+ _blurX = value;
+ notifyFilterChanged();
+ }
+ }
+
+ //----------------------------------
+ // blurY
+ //----------------------------------
+
+ private var _blurY:Number = 4.0;
+
+ [Inspectable(minValue="0.0", maxValue="255.0")]
+
+ /**
+ * The amount of vertical blur. Valid values are 0 to 255. A blur of 1
+ * or less means that the original image is copied as is. The default
+ * value is 4. Values that are a power of 2 (such as 2, 4, 8, 16, and 32)
+ * are optimized to render more quickly than other values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get blurY():Number
+ {
+ return _blurY;
+ }
+
+ /**
+ * @private
+ */
+ public function set blurY(value:Number):void
+ {
+ if (value != _blurY)
+ {
+ _blurY = value;
+ notifyFilterChanged();
+ }
+ }
+
+ //----------------------------------
+ // knockout
+ //----------------------------------
+
+ private var _knockout:Boolean = false;
+
+ /**
+ * Specifies whether the object has a knockout effect. A knockout effect
+ * makes the object's fill transparent and reveals the background color
+ * of the document. The value true specifies a knockout effect; the
+ * default value is false (no knockout effect).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get knockout():Boolean
+ {
+ return _knockout;
+ }
+
+ /**
+ * @private
+ */
+ public function set knockout(value:Boolean):void
+ {
+ if (value != _knockout)
+ {
+ _knockout = value;
+ notifyFilterChanged();
+ }
+ }
+
+ //----------------------------------
+ // quality
+ //----------------------------------
+
+ //private var _quality:int = BitmapFilterQuality.LOW;
+ private var _quality:int = 1;
+
+ [Inspectable(minValue="1", maxValue="15")]
+
+ /**
+ * The number of times to apply the filter. The default value is
+ * BitmapFilterQuality.LOW, which is equivalent to applying the filter
+ * once. The value BitmapFilterQuality.MEDIUM applies the filter twice;
+ * the value BitmapFilterQuality.HIGH applies it three times. Filters
+ * with lower values are rendered more quickly.
+ *
+ * For most applications, a quality value of low, medium, or high is
+ * sufficient. Although you can use additional numeric values up to 15
+ * to achieve different effects, higher values are rendered more slowly.
+ * Instead of increasing the value of quality, you can often get a similar
+ * effect, and with faster rendering, by simply increasing the values of
+ * the blurX and blurY properties.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get quality():int
+ {
+ return _quality;
+ }
+
+ /**
+ * @private
+ */
+ public function set quality(value:int):void
+ {
+ if (value != _quality)
+ {
+ _quality = value;
+ notifyFilterChanged();
+ }
+ }
+
+ //----------------------------------
+ // strength
+ //----------------------------------
+
+ private var _strength:Number = 1;
+
+ [Inspectable(minValue="0.0", maxValue="255.0")]
+
+ /**
+ * The strength of the imprint or spread. The higher the value, the more
+ * color is imprinted and the stronger the contrast between the glow and
+ * the background. Valid values are 0 to 255. A value of 0 means that the
+ * filter is not applied. The default value is 1.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get strength():Number
+ {
+ return _strength;
+ }
+
+ /**
+ * @private
+ */
+ public function set strength(value:Number):void
+ {
+ if (value != _strength)
+ {
+ _strength = value;
+ notifyFilterChanged();
+ }
+ }
+}
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/filters/BaseFilter.as b/frameworks/projects/MXRoyale/src/main/royale/mx/filters/BaseFilter.as
new file mode 100644
index 0000000..b09a8cc
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/filters/BaseFilter.as
@@ -0,0 +1,76 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.filters
+{
+ import org.apache.royale.events.EventDispatcher;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.events.Event;
+
+ /**
+ * Base class for some Spark filters.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public class BaseFilter extends EventDispatcher
+ {
+ /**
+ * The string <code>"change"</code>. Used by the event when the filter has changed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const CHANGE:String = "change";
+
+ /**
+ * Constructor.
+ *
+ * @param target The target to which the filter is applied.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function BaseFilter(target:IEventDispatcher=null)
+ {
+ super(target);
+ }
+
+ /**
+ * Propagates a change event when the filter has changed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function notifyFilterChanged():void
+ {
+ dispatchEvent(new Event(CHANGE));
+ }
+
+ }
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/filters/IBitmapFilter.as b/frameworks/projects/MXRoyale/src/main/royale/mx/filters/IBitmapFilter.as
new file mode 100644
index 0000000..5b9297e
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/filters/IBitmapFilter.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.filters
+{
+ //import flash.filters.BitmapFilter;
+
+ /**
+ * Interface used by some Spark filters.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public interface IBitmapFilter
+ {
+ /**
+ * Returns a copy of the filter.
+ *
+ * @return A new BitmapFilter instance with all the same properties as the original BitmapFilter instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ function clone():Object;
+ //function clone():BitmapFilter;
+ }
+}
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/filters/GlowFilter.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/filters/GlowFilter.as
index 1661876..a5347bf 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/filters/GlowFilter.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/filters/GlowFilter.as
@@ -19,8 +19,8 @@
package spark.filters
{
-import flash.filters.BitmapFilter;
-import flash.filters.GlowFilter;
+//import flash.filters.BitmapFilter;
+//import flash.filters.GlowFilter;
import mx.filters.BaseDimensionFilter;
import mx.filters.IBitmapFilter;
@@ -253,9 +253,10 @@ public class GlowFilter extends BaseDimensionFilter implements IBitmapFilter
* @playerversion AIR 1.5
* @productversion Flex 4
*/
- public function clone():BitmapFilter
+ public function clone():Object
{
- return new flash.filters.GlowFilter(color, alpha, blurX, blurY, strength, quality, inner, knockout);
+ //return new flash.filters.GlowFilter(color, alpha, blurX, blurY, strength, quality, inner, knockout);
+ return null;
}