You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2016/07/06 16:33:50 UTC
git commit: [flex-asjs] [refs/heads/develop] - Added StringEvent and
ColorUtils
Repository: flex-asjs
Updated Branches:
refs/heads/develop 953167882 -> 03dd92e2b
Added StringEvent and ColorUtils
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/03dd92e2
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/03dd92e2
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/03dd92e2
Branch: refs/heads/develop
Commit: 03dd92e2bb6c2effc1461ef773f02fab8fd75d07
Parents: 9531678
Author: Harbs <ha...@in-tools.com>
Authored: Wed Jul 6 19:33:45 2016 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Wed Jul 6 19:33:45 2016 +0300
----------------------------------------------------------------------
.../projects/Core/src/main/flex/CoreClasses.as | 2 +
.../flex/org/apache/flex/events/StringEvent.as | 60 +++++++
.../flex/org/apache/flex/utils/ColorUtil.as | 165 +++++++++++++++++++
.../Network/src/main/flex/NetworkClasses.as | 4 +-
.../flex/org/apache/flex/net/HTTPConstants.as | 24 ++-
5 files changed, 251 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03dd92e2/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index 90badd8..ab41144 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -103,6 +103,7 @@ internal class CoreClasses
import org.apache.flex.events.EventDispatcher; EventDispatcher;
import org.apache.flex.events.IEventDispatcher; IEventDispatcher;
import org.apache.flex.events.MouseEvent; MouseEvent;
+ import org.apache.flex.events.StringEvent; StringEvent;
import org.apache.flex.events.ValueEvent; ValueEvent;
import org.apache.flex.events.utils.MouseUtils; MouseUtils;
import org.apache.flex.geom.Point; Point;
@@ -112,6 +113,7 @@ internal class CoreClasses
{
import org.apache.flex.utils.CSSBorderUtils; CSSBorderUtils;
}
+ import org.apache.flex.utils.ColorUtil; ColorUtil;
import org.apache.flex.utils.CSSContainerUtils; CSSContainerUtils;
COMPILE::SWF
{
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03dd92e2/frameworks/projects/Core/src/main/flex/org/apache/flex/events/StringEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/StringEvent.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/StringEvent.as
new file mode 100644
index 0000000..fa24932
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/StringEvent.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.flex.events
+{
+
+ /**
+ * The StringEvent class is used for dispatching an event
+ * that has a string payload
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StringEvent extends Event
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StringEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false,
+ payload:String = null)
+ {
+ super(type, bubbles, cancelable);
+
+ this.payload = payload;
+ }
+
+ /**
+ * The value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var payload:String;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03dd92e2/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ColorUtil.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ColorUtil.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ColorUtil.as
new file mode 100644
index 0000000..cc53be0
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ColorUtil.as
@@ -0,0 +1,165 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.flex.utils
+{
+
+ /**
+ * The ColorUtil class is an all-static class
+ * with methods for working with RGB colors within Flex.
+ * You do not create instances of ColorUtil;
+ * instead you simply call static methods such as
+ * the <code>ColorUtil.adjustBrightness()</code> method.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ColorUtil
+ {
+
+ //--------------------------------------------------------------------------
+ //
+ // Class methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Performs a linear brightness adjustment of an RGB color.
+ *
+ * <p>The same amount is added to the red, green, and blue channels
+ * of an RGB color.
+ * Each color channel is limited to the range 0 through 255.</p>
+ *
+ * @param rgb Original RGB color.
+ *
+ * @param brite Amount to be added to each color channel.
+ * The range for this parameter is -255 to 255;
+ * -255 produces black while 255 produces white.
+ * If this parameter is 0, the RGB color returned
+ * is the same as the original color.
+ *
+ * @return New RGB color.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function adjustBrightness(rgb:uint, brite:Number):uint
+ {
+ var r:Number = Math.max(Math.min(((rgb >> 16) & 0xFF) + brite, 255), 0);
+ var g:Number = Math.max(Math.min(((rgb >> 8) & 0xFF) + brite, 255), 0);
+ var b:Number = Math.max(Math.min((rgb & 0xFF) + brite, 255), 0);
+
+ return (r << 16) | (g << 8) | b;
+ }
+
+ /**
+ * Performs a scaled brightness adjustment of an RGB color.
+ *
+ * @param rgb Original RGB color.
+ *
+ * @param brite The percentage to brighten or darken the original color.
+ * If positive, the original color is brightened toward white
+ * by this percentage. If negative, it is darkened toward black
+ * by this percentage.
+ * The range for this parameter is -100 to 100;
+ * -100 produces black while 100 produces white.
+ * If this parameter is 0, the RGB color returned
+ * is the same as the original color.
+ *
+ * @return New RGB color.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function adjustBrightness2(rgb:uint, brite:Number):uint
+ {
+ var r:Number;
+ var g:Number;
+ var b:Number;
+
+ if (brite == 0)
+ return rgb;
+
+ if (brite < 0)
+ {
+ brite = (100 + brite) / 100;
+ r = ((rgb >> 16) & 0xFF) * brite;
+ g = ((rgb >> 8) & 0xFF) * brite;
+ b = (rgb & 0xFF) * brite;
+ }
+ else // bright > 0
+ {
+ brite /= 100;
+ r = ((rgb >> 16) & 0xFF);
+ g = ((rgb >> 8) & 0xFF);
+ b = (rgb & 0xFF);
+
+ r += ((0xFF - r) * brite);
+ g += ((0xFF - g) * brite);
+ b += ((0xFF - b) * brite);
+
+ r = Math.min(r, 255);
+ g = Math.min(g, 255);
+ b = Math.min(b, 255);
+ }
+
+ return (r << 16) | (g << 8) | b;
+ }
+
+ /**
+ * Performs an RGB multiplication of two RGB colors.
+ *
+ * <p>This always results in a darker number than either
+ * original color unless one of them is white,
+ * in which case the other color is returned.</p>
+ *
+ * @param rgb1 First RGB color.
+ *
+ * @param rgb2 Second RGB color.
+ *
+ * @return RGB multiplication of the two colors.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function rgbMultiply(rgb1:uint, rgb2:uint):uint
+ {
+ var r1:Number = (rgb1 >> 16) & 0xFF;
+ var g1:Number = (rgb1 >> 8) & 0xFF;
+ var b1:Number = rgb1 & 0xFF;
+
+ var r2:Number = (rgb2 >> 16) & 0xFF;
+ var g2:Number = (rgb2 >> 8) & 0xFF;
+ var b2:Number = rgb2 & 0xFF;
+
+ return ((r1 * r2 / 255) << 16) |
+ ((g1 * g2 / 255) << 8) |
+ (b1 * b2 / 255);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03dd92e2/frameworks/projects/Network/src/main/flex/NetworkClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/NetworkClasses.as b/frameworks/projects/Network/src/main/flex/NetworkClasses.as
index e201410..a649df0 100644
--- a/frameworks/projects/Network/src/main/flex/NetworkClasses.as
+++ b/frameworks/projects/Network/src/main/flex/NetworkClasses.as
@@ -17,8 +17,7 @@
//
////////////////////////////////////////////////////////////////////////////////
package
-{
-
+{
/**
* @private
@@ -29,6 +28,7 @@ package
internal class NetworkClasses
{
import org.apache.flex.net.URLBinaryLoader; URLBinaryLoader;
+ import org.apache.flex.net.HTTPConstants; HTTPConstants;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/03dd92e2/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPConstants.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPConstants.as b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPConstants.as
index 3ca2068..552a745 100644
--- a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPConstants.as
+++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPConstants.as
@@ -56,7 +56,17 @@ package org.apache.flex.net
*/
public static const DELETE:String = "DELETE";
- /**
+ /**
+ * Dispatched when the connection is opened.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static const OPEN:String = "open";
+
+ /**
* Dispatched when the request is complete.
*
* @langversion 3.0
@@ -75,7 +85,17 @@ package org.apache.flex.net
* @productversion FlexJS 0.0
*/
public static const IO_ERROR:String = "ioError";
-
+
+ /**
+ * Dispatched if a security error occurs in the server communication.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static const SECURITY_ERROR:String = "securityError";
+
/**
* Dispatched when an httpStatus code is received from the server.
*