You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bi...@apache.org on 2014/09/17 03:25:25 UTC

[1/7] git commit: [flex-asjs] [refs/heads/develop] - Added support for LinearGradient on AS3 side. JS version, up next

Repository: flex-asjs
Updated Branches:
  refs/heads/develop e6419b7a8 -> 9999c237a


Added support for LinearGradient on AS3 side.  JS version, up next


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4fce4e59
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4fce4e59
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4fce4e59

Branch: refs/heads/develop
Commit: 4fce4e59e119a55d1959eec6cbb316d0d830fb57
Parents: e6419b7
Author: Om <bi...@gmail.com>
Authored: Mon Sep 15 12:24:41 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Tue Sep 16 18:24:44 2014 -0700

----------------------------------------------------------------------
 examples/FlexJSTest_SVG/src/GraphicsView.mxml   |  21 ++
 .../as/projects/FlexJSUI/src/FlexJSUIClasses.as |   1 +
 .../src/org/apache/flex/core/graphics/Circle.as |  15 +-
 .../org/apache/flex/core/graphics/Ellipse.as    |  13 +-
 .../apache/flex/core/graphics/GradientBase.as   | 191 +++++++++++++++++++
 .../apache/flex/core/graphics/GradientEntry.as  | 127 ++++++++++++
 .../apache/flex/core/graphics/GraphicShape.as   |  18 +-
 .../flex/core/graphics/GraphicsContainer.as     |  11 +-
 .../src/org/apache/flex/core/graphics/IFill.as  |   4 +-
 .../apache/flex/core/graphics/LinearGradient.as |  56 ++++++
 .../src/org/apache/flex/core/graphics/Path.as   |  13 +-
 .../src/org/apache/flex/core/graphics/Rect.as   |  13 +-
 .../org/apache/flex/core/graphics/SolidColor.as |   4 +-
 13 files changed, 432 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/examples/FlexJSTest_SVG/src/GraphicsView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_SVG/src/GraphicsView.mxml b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
index 5e562df..bad453c 100644
--- a/examples/FlexJSTest_SVG/src/GraphicsView.mxml
+++ b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
@@ -26,7 +26,9 @@ limitations under the License.
         <![CDATA[            
 			import org.apache.flex.core.graphics.Circle;
 			import org.apache.flex.core.graphics.Ellipse;
+			import org.apache.flex.core.graphics.GradientEntry;
 			import org.apache.flex.core.graphics.GraphicsContainer;
+			import org.apache.flex.core.graphics.LinearGradient;
 			import org.apache.flex.core.graphics.Path;
 			import org.apache.flex.core.graphics.Rect;
 			import org.apache.flex.core.graphics.SolidColor;
@@ -195,21 +197,40 @@ limitations under the License.
 				var container:GraphicsContainer = new GraphicsContainer();
 				container.fill = fill;
 				container.stroke = stroke;
+				//Circle
 				container.drawCircle(300,300,200);
 				fill.color = 0x00FF00;
 				stroke.color = 0x0000FF;
+				//Rect
 				container.drawRect(0,400,500,200);
 				fill.color = 0x00FFFF;
 				stroke.color = 0xFF00FF;
+				//Ellipse
 				container.drawEllipse(600,300,200,300);
 				fill.color = 0xCCCC00;
 				stroke.color = 0x000000;
+				//Path
 				container.drawPath("M 100 350 q 150 -300 300 0");
 				fill.color = 0x00CCCC;
 				stroke.color = 0x0CCCC0C;
 				stroke.weight = 5;
 				container.drawPath("M 800 800 L 900 800 A 100 100 0 0 0 800 700 Z");
 				
+				//LinearGradient Fill
+				var lg:LinearGradient = new LinearGradient();
+				lg.entries = [new GradientEntry(1,0xFFFFFF,0), new GradientEntry(1,0x000000,1)];
+				lg.scaleX = 1;
+				lg.rotation = 0;
+				container.fill = lg;
+				container.drawRect(20,20,200,100);
+				this.addElement(container);
+
+				var lg:LinearGradient = new LinearGradient();
+				lg.entries = [new GradientEntry(0.5,0xFFFFFF,0), new GradientEntry(0.9,0x000000,1)];
+				lg.scaleX = 2;
+				lg.rotation = 90;
+				container.fill = lg;
+				container.drawCircle(400, 400, 300);
 				this.addElement(container);
 			}
 			

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index 40bba34..a8e2a45 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -124,6 +124,7 @@ internal class FlexJSUIClasses
 	import org.apache.flex.core.graphics.SolidColor; SolidColor;
 	import org.apache.flex.core.graphics.SolidColorStroke; SolidColorStroke;
 	import org.apache.flex.core.graphics.GraphicsContainer; GraphicsContainer;
+	import org.apache.flex.core.graphics.LinearGradient; LinearGradient;
     
 	import mx.core.ClassFactory; ClassFactory;
     import mx.states.AddItems; AddItems;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
index 5e5cc29..d49a8a6 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
@@ -1,7 +1,6 @@
 package org.apache.flex.core.graphics
 {
-	import flash.display.CapsStyle;
-	import flash.display.JointStyle;
+	import flash.geom.Rectangle;
 
 	public class Circle extends GraphicShape
 	{
@@ -20,16 +19,10 @@ package org.apache.flex.core.graphics
 		public function drawCircle(x:Number, y:Number, radius:Number):void
 		{
 			graphics.clear();
-			if(stroke)
-			{
-				graphics.lineStyle(stroke.weight,stroke.color,stroke.alpha,false,"normal",CapsStyle.SQUARE,JointStyle.MITER);
-			}
-			if(fill)
-			{
-				graphics.beginFill(fill.color,fill.alpha);
-			}
+			applyStroke();
+			beginFill(new Rectangle(x, y, radius*2, radius*2));
 			graphics.drawCircle(x,y,radius);
-			graphics.endFill();
+			endFill();
 		}
 		
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
index 0763c3b..db1a6ae 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
@@ -2,6 +2,7 @@ package org.apache.flex.core.graphics
 {
 	import flash.display.CapsStyle;
 	import flash.display.JointStyle;
+	import flash.geom.Rectangle;
 
 	public class Ellipse extends GraphicShape
 	{
@@ -21,16 +22,10 @@ package org.apache.flex.core.graphics
 		public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
 		{
 			graphics.clear();
-			if(stroke)
-			{
-				graphics.lineStyle(stroke.weight,stroke.color,stroke.alpha,false,"normal",CapsStyle.SQUARE,JointStyle.MITER);
-			}
-			if(fill)
-			{
-				graphics.beginFill(fill.color,fill.alpha);
-			}
+			applyStroke();
+			beginFill(new Rectangle(x, y, width, height));
 			graphics.drawEllipse(x,y,width,height);
-			graphics.endFill();
+			endFill();
 		}
 		
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as
new file mode 100644
index 0000000..82c740b
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as
@@ -0,0 +1,191 @@
+/**
+ * Licensed 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.core.graphics
+{
+
+	public class GradientBase
+	{
+		
+		protected var colors:Array /* of uint */ = [];
+		
+		protected var ratios:Array /* of Number */ = [];
+		
+		protected var alphas:Array /* of Number */ = [];
+		
+
+		/**
+		 *  Storage for the entries property.
+		 */
+		private var _entries:Array = [];
+		
+		/**
+		 *  @private
+		 *  Storage for the rotation property.
+		 */
+		private var _rotation:Number = 0.0;
+		
+		/**
+		 *  An Array of GradientEntry objects
+		 *  defining the fill patterns for the gradient fill.
+		 *
+		 */
+		public function get entries():Array
+		{
+			return _entries;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set entries(value:Array):void
+		{
+			_entries = value;
+			processEntries();
+		}
+		
+		/**
+		 *  By default, the LinearGradientStroke defines a transition
+		 *  from left to right across the control. 
+		 *  Use the <code>rotation</code> property to control the transition direction. 
+		 *  For example, a value of 180.0 causes the transition
+		 *  to occur from right to left, rather than from left to right.
+		 *
+		 *  @default 0.0
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function get rotation():Number
+		{
+			return _rotation;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set rotation(value:Number):void
+		{
+			_rotation = value;   
+		}
+		
+		
+		private var _x:Number = 0;
+		
+		/**
+		 *  The distance by which to translate each point along the x axis.
+		 */
+		public function get x():Number
+		{
+			return _x;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set x(value:Number):void
+		{
+			_x = value;
+		}
+		
+		private var _y:Number = 0;
+		
+		/**
+		 *  The distance by which to translate each point along the y axis.
+		 */
+		public function get y():Number
+		{
+			return _y;    
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set y(value:Number):void
+		{
+			_y = value;                
+		}
+
+		
+		protected function toRad(a:Number):Number {
+			return a*Math.PI/180;
+		}
+		
+		/**
+		 *  @private
+		 *  Extract the gradient information in the public <code>entries</code>
+		 *  Array into the internal <code>colors</code>, <code>ratios</code>,
+		 *  and <code>alphas</code> arrays.
+		 */
+		private function processEntries():void
+		{
+			colors = [];
+			ratios = [];
+			alphas = [];
+			
+			if (!_entries || _entries.length == 0)
+				return;
+			
+			var ratioConvert:Number = 255;
+			
+			var i:int;
+			
+			var n:int = _entries.length;
+			for (i = 0; i < n; i++)
+			{
+				var e:GradientEntry = _entries[i];
+				colors.push(e.color);
+				alphas.push(e.alpha);
+				ratios.push(e.ratio * ratioConvert);
+			}
+			
+			if (isNaN(ratios[0]))
+				ratios[0] = 0;
+			
+			if (isNaN(ratios[n - 1]))
+				ratios[n - 1] = 255;
+			
+			i = 1;
+			
+			while (true)
+			{
+				while (i < n && !isNaN(ratios[i]))
+				{
+					i++;
+				}
+				
+				if (i == n)
+					break;
+				
+				var start:int = i - 1;
+				
+				while (i < n && isNaN(ratios[i]))
+				{
+					i++;
+				}
+				
+				var br:Number = ratios[start];
+				var tr:Number = ratios[i];
+				
+				for (var j:int = 1; j < i - start; j++)
+				{
+					ratios[j] = br + j * (tr - br) / (i - start);
+				}
+			}
+		}
+
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientEntry.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientEntry.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientEntry.as
new file mode 100644
index 0000000..92a1765
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientEntry.as
@@ -0,0 +1,127 @@
+/**
+ * Licensed 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.core.graphics
+{
+	public class GradientEntry
+	{
+		
+		//----------------------------------
+		//  alpha
+		//----------------------------------
+		
+		private var _alpha:Number = 1.0;
+		//----------------------------------
+		//  color
+		//----------------------------------
+		
+		private var _color:uint = 0x000000;
+		//----------------------------------
+		//  ratio
+		//----------------------------------
+		
+		private var _ratio:Number = 0x000000;
+		
+		
+		public function GradientEntry(alpha:Number, color:uint, ratio:Number)
+		{
+			_alpha = alpha;
+			_color = color;
+			_ratio = ratio;
+		}
+		
+		/**
+		 *  The transparency of a color.
+		 *  Possible values are 0.0 (invisible) through 1.0 (opaque). 
+		 *  
+		 *  @default 1.0
+		 *  
+	     *  @langversion 3.0
+	     *  @playerversion Flash 10.2
+	     *  @playerversion AIR 2.6
+	     *  @productversion FlexJS 0.3
+		 */
+		public function get alpha():Number
+		{
+			return _alpha;
+		}
+		
+		public function set alpha(value:Number):void
+		{
+			var oldValue:Number = _alpha;
+			if (value != oldValue)
+			{
+				_alpha = value;
+			}
+		}
+		
+		/**
+		 *  A color value. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+	     *  @productversion FlexJS 0.3
+		 */
+		public function get color():uint
+		{
+			return _color;
+		}
+		
+		public function set color(value:uint):void
+		{
+			var oldValue:uint = _color;
+			if (value != oldValue)
+			{
+				_color = value;
+			}
+		}
+		
+		/**
+		 *  Where in the graphical element, as a percentage from 0.0 to 1.0,
+     	 *  Flex samples the associated color at 100%.  
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+	     *  @productversion FlexJS 0.3
+		 */
+		public function get ratio():Number
+		{
+			return _ratio;
+		}
+
+		public function set ratio(value:Number):void
+		{
+			_ratio = value;
+		}
+		
+		/**
+		 * Begin drawing the fill on the given shape's graphic object
+		 */
+		public function begin(s:GraphicShape):void
+		{
+			s.graphics.beginFill(color,alpha);
+		}
+		
+		/**
+		 * End the fill
+		 */
+		public function end(s:GraphicShape):void
+		{
+			s.graphics.endFill();
+		}
+
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
index c2ab3f5..65c4f32 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
@@ -15,14 +15,16 @@
 package org.apache.flex.core.graphics
 {
 	
+	import flash.geom.Rectangle;
+	
 	import org.apache.flex.core.UIBase;
 	
 	public class GraphicShape extends UIBase
 	{
-		private var _fill:SolidColor;
-		private var _stroke:SolidColorStroke;
+		private var _fill:IFill;
+		private var _stroke:IStroke;
 		
-		public function get stroke():SolidColorStroke
+		public function get stroke():IStroke
 		{
 			return _stroke;
 		}
@@ -35,12 +37,12 @@ package org.apache.flex.core.graphics
 		 *  @playerversion AIR 1.1
 		 *  @productversion FlexJS 0.0
 		 */
-		public function set stroke(value:SolidColorStroke):void
+		public function set stroke(value:IStroke):void
 		{
 			_stroke = value;
 		}
 		
-		public function get fill():SolidColor
+		public function get fill():IFill
 		{
 			return _fill;
 		}
@@ -52,7 +54,7 @@ package org.apache.flex.core.graphics
 		 *  @playerversion AIR 1.1
 		 *  @productversion FlexJS 0.0
 		 */
-		public function set fill(value:SolidColor):void
+		public function set fill(value:IFill):void
 		{
 			_fill = value;
 		}
@@ -65,11 +67,11 @@ package org.apache.flex.core.graphics
 			}
 		}
 		
-		protected function beginFill():void
+		protected function beginFill(targetBounds:Rectangle):void
 		{
 			if(fill)
 			{
-				fill.begin(this);
+				fill.begin(this, targetBounds);
 			}
 		}
 		

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
index 2d1c347..c99b3a7 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
@@ -14,9 +14,8 @@
  
 package org.apache.flex.core.graphics
 {
-	import flash.display.CapsStyle;
 	import flash.display.GraphicsPath;
-	import flash.display.JointStyle;
+	import flash.geom.Rectangle;
 	
 	import org.apache.flex.core.graphics.utils.PathHelper;
 	
@@ -45,7 +44,7 @@ package org.apache.flex.core.graphics
 		public function drawRect(x:Number, y:Number, width:Number, height:Number):void
 		{
 			applyStroke();
-			beginFill();
+			beginFill(new Rectangle(x, y, width, height));
 			graphics.drawRect(x, y, width, height);
 			endFill();
 		}
@@ -65,7 +64,7 @@ package org.apache.flex.core.graphics
 		public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
 		{
 			applyStroke();
-			beginFill();
+			beginFill(new Rectangle(x,y,width,height));
 			graphics.drawEllipse(x,y,width,height);
 			endFill();
 		}
@@ -84,7 +83,7 @@ package org.apache.flex.core.graphics
 		public function drawCircle(x:Number, y:Number, radius:Number):void
 		{
 			applyStroke();
-			beginFill();
+			beginFill(new Rectangle(x,y,radius*2, radius*2));
 			graphics.drawCircle(x,y,radius);
 			endFill();
 		}
@@ -107,7 +106,7 @@ package org.apache.flex.core.graphics
 		public function drawPath(data:String):void
 		{
 			applyStroke();
-			beginFill();
+			beginFill(new Rectangle());
 			var graphicsPath:GraphicsPath = PathHelper.getSegments(data);
 			graphics.drawPath(graphicsPath.commands, graphicsPath.data);
 			endFill();

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
index 65c35b0..6ecbb8a 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
@@ -14,9 +14,11 @@
 
 package org.apache.flex.core.graphics
 {
+	import flash.geom.Rectangle;
+
 	public interface IFill
 	{
-		function begin(s:GraphicShape):void;
+		function begin(s:GraphicShape,targetBounds:Rectangle):void;
 		function end(s:GraphicShape):void;
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as
new file mode 100644
index 0000000..87d1fb0
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as
@@ -0,0 +1,56 @@
+/**
+ * Licensed 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.core.graphics
+{
+	import flash.display.GradientType;
+	import flash.display.InterpolationMethod;
+	import flash.display.SpreadMethod;
+	import flash.geom.Matrix;
+	import flash.geom.Rectangle;
+	
+	public class LinearGradient extends GradientBase implements IFill
+	{
+		
+		private static var commonMatrix:Matrix = new Matrix();
+		private var _scaleX:Number;
+		
+		/**
+		 *  The horizontal scale of the gradient transform, which defines the width of the (unrotated) gradient
+		 */
+		public function get scaleX():Number
+		{
+			return _scaleX;
+		}
+		
+		public function set scaleX(value:Number):void
+		{
+			_scaleX = value;
+		}
+		
+		public function begin(s:GraphicShape,targetBounds:Rectangle):void
+		{
+			commonMatrix.identity();
+			commonMatrix.createGradientBox(targetBounds.width,targetBounds.height,toRad(this.rotation));
+			
+			s.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios,
+				commonMatrix, SpreadMethod.PAD, InterpolationMethod.RGB);
+		}
+		
+		public function end(s:GraphicShape):void
+		{
+			s.graphics.endFill();
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
index 6f8324f..ec14340 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
@@ -29,22 +29,15 @@ package org.apache.flex.core.graphics
 		public function drawPath(x:Number,y:Number,data:String):void
 		{
 			graphics.clear();
-			if(stroke)
-			{
-				graphics.lineStyle(stroke.weight,stroke.color,stroke.alpha,false,"normal",CapsStyle.SQUARE,JointStyle.MITER);
-			}
-			if(fill)
-			{
-				graphics.beginFill(fill.color,fill.alpha);
-			}
+			applyStroke();
+			beginFill(new Rectangle());
 			segments = new PathSegmentsCollection(data);
 			if (segments)
 				segments.generateGraphicsPath(graphicsPath, x, y, 1, 1);
 			
 			graphics.drawPath(graphicsPath.commands, graphicsPath.data);
-			graphics.endFill();
+			endFill();
 		}
-		
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
index 989477d..6d82bf6 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
@@ -2,6 +2,7 @@ package org.apache.flex.core.graphics
 {
 	import flash.display.CapsStyle;
 	import flash.display.JointStyle;
+	import flash.geom.Rectangle;
 
 	public class Rect extends GraphicShape
 	{
@@ -21,16 +22,10 @@ package org.apache.flex.core.graphics
 		public function drawRect(x:Number, y:Number, width:Number, height:Number):void
 		{
 			graphics.clear();
-			if(stroke)
-			{
-				graphics.lineStyle(stroke.weight,stroke.color,stroke.alpha,false,"normal",CapsStyle.SQUARE,JointStyle.MITER);
-			}
-			if(fill)
-			{
-				graphics.beginFill(fill.color,fill.alpha);
-			}
+			applyStroke();
+			beginFill(new Rectangle(x, y, width, height));
 			graphics.drawRect(x, y, width, height);
-			graphics.endFill();
+			endFill();
 		}
 		
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4fce4e59/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
index 2c2dc08..bc0d913 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
@@ -14,6 +14,8 @@
 
 package org.apache.flex.core.graphics
 {
+	import flash.geom.Rectangle;
+
 	public class SolidColor implements IFill
 	{
 		
@@ -75,7 +77,7 @@ package org.apache.flex.core.graphics
 			}
 		}
 		
-		public function begin(s:GraphicShape):void
+		public function begin(s:GraphicShape,targetBounds:Rectangle):void
 		{
 			s.graphics.beginFill(color,alpha);
 		}


[3/7] git commit: [flex-asjs] [refs/heads/develop] - Remove unnecessary trace

Posted by bi...@apache.org.
Remove unnecessary trace


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/51d604ff
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/51d604ff
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/51d604ff

Branch: refs/heads/develop
Commit: 51d604ffbaf28c27a83ad478bbe7a9ecb2a9c5d7
Parents: 4fce4e5
Author: Om <bi...@gmail.com>
Authored: Tue Sep 16 17:37:11 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Tue Sep 16 18:24:45 2014 -0700

----------------------------------------------------------------------
 .../as/projects/FlexJSUI/src/org/apache/flex/core/Application.as    | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/51d604ff/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
index 45c35f4..54f4f8b 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
@@ -100,7 +100,6 @@ package org.apache.flex.core
 				stage.align = StageAlign.TOP_LEFT;
 				stage.scaleMode = StageScaleMode.NO_SCALE;
 				stage.quality = StageQuality.HIGH_16X16_LINEAR;
-				trace("working");
 			}
 			
             loaderInfo.addEventListener(flash.events.Event.INIT, initHandler);


[5/7] Add support for LinearGradient for AS and JS versions. Includes support for gradient rotation as well. Elliptical Arc (A) property of Path does not support gradient rotations (yet) in the AS version

Posted by bi...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
index 4b44a9c..2fd902a 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
@@ -27,13 +27,13 @@ org.apache.flex.core.graphics.GraphicShape = function() {
 
   /**
    * @private
-   * @type {org.apache.flex.core.graphics.SolidColor}
+   * @type {org.apache.flex.core.graphics.IFill}
    */
   this.fill_ = null;
 
   /**
    * @private
-   * @type {org.apache.flex.core.graphics.SolidColorStroke}
+   * @type {org.apache.flex.core.graphics.IStroke}
    */
   this.stroke_ = null;
 
@@ -83,7 +83,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.FLEXJS_CLASS_INFO =
 
 /**
  * @expose
- * @return {org.apache.flex.core.graphics.SolidColor} The fill object.
+ * @return {org.apache.flex.core.graphics.IFill} The fill object.
  */
 org.apache.flex.core.graphics.GraphicShape.prototype.get_fill = function() {
   return this.fill_;
@@ -91,7 +91,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.get_fill = function() {
 
 
 /**
- * @param {org.apache.flex.core.graphics.SolidColor} value The fill object.
+ * @param {org.apache.flex.core.graphics.IFill} value The fill object.
  */
 org.apache.flex.core.graphics.GraphicShape.prototype.set_fill = function(value) {
   this.fill_ = value;
@@ -100,7 +100,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.set_fill = function(value)
 
 /**
  * @expose
- * @return {org.apache.flex.core.graphics.SolidColorStroke} The stroke object.
+ * @return {org.apache.flex.core.graphics.IStroke} The stroke object.
  */
 org.apache.flex.core.graphics.GraphicShape.prototype.get_stroke = function() {
   return this.stroke_;
@@ -109,7 +109,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.get_stroke = function() {
 
 /**
  * @expose
- * @param {org.apache.flex.core.graphics.SolidColorStroke} value The stroke object.
+ * @param {org.apache.flex.core.graphics.IStroke} value The stroke object.
  */
 org.apache.flex.core.graphics.GraphicShape.prototype.set_stroke = function(value) {
   this.stroke_ = value;
@@ -117,7 +117,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.set_stroke = function(value
 
 
 /**
- * @override
+ * 
  */
 org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function() {
   var bbox = this.element.getBBox();
@@ -164,7 +164,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() {
 org.apache.flex.core.graphics.GraphicShape.prototype.resize = function(x, y, bbox) {
   this.element.setAttribute('width', String(bbox.width + bbox.x + this.xOffset_) + 'px');
   this.element.setAttribute('height', String(bbox.height + bbox.y + this.yOffset_) + 'px');
-  this.element.setAttribute('style', 'overflow:visible; position:absolute; left:' + String(x) + 'px; top:' + String(y));
+  this.element.setAttribute('style', 'overflow:visible; position:absolute; left:' + String(x) + 'px; top:' + String(y) + 'px');
 };
 
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/LinearGradient.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/LinearGradient.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/LinearGradient.js
new file mode 100644
index 0000000..1ef3e71
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/LinearGradient.js
@@ -0,0 +1,124 @@
+/**
+ * Licensed 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.
+ */
+
+/**
+ * org.apache.flex.core.graphics.LinearGradient
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.graphics.LinearGradient');
+goog.require('org.apache.flex.core.graphics.GradientBase');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.graphics.GradientBase}
+ * @implements {org.apache.flex.core.graphics.IFill}
+ */
+org.apache.flex.core.graphics.LinearGradient = function() {
+  org.apache.flex.core.graphics.LinearGradient.base(this, 'constructor');
+};
+goog.inherits(org.apache.flex.core.graphics.LinearGradient, org.apache.flex.core.graphics.GradientBase);
+
+
+/**
+ * @private
+ * @type {number}
+ */
+org.apache.flex.core.graphics.LinearGradient.prototype._scaleX;
+
+
+/**
+ * @expose
+ * @return {number}
+ */
+org.apache.flex.core.graphics.LinearGradient.prototype.get_scaleX = function() {
+  return this._scaleX;
+};
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.graphics.LinearGradient.prototype.set_scaleX = function(value) {
+  this._scaleX = value;
+};
+
+
+/**
+ * addFillAttrib()
+ *
+ * @expose
+ * @param {org.apache.flex.core.graphics.GraphicShape} value The GraphicShape object on which the fill must be added.
+ * @return {string}
+ */
+org.apache.flex.core.graphics.LinearGradient.prototype.addFillAttrib = function(value) {
+  //Create and add a linear gradient def
+  var svgNS = value.element.namespaceURI;
+  var grad  = document.createElementNS(svgNS,'linearGradient');
+  var gradientId = this.get_newId();
+  grad.setAttribute('id',gradientId);
+
+  //Set x1, y1, x2, y2 of gradient
+  grad.setAttribute('x1','0%');
+  grad.setAttribute('y1','0%');
+  grad.setAttribute('x2','100%');
+  grad.setAttribute('y2','0%');
+
+  //Apply rotation to the gradient if get_rotatation() is a number
+  if (this.get_rotation() )
+  {
+    grad.setAttribute('gradientTransform', 'rotate(' + this.get_rotation() +  ' 0.5 0.5)');
+  }
+
+  //Process gradient entries and create a stop for each entry  
+  var entries = this.get_entries();
+  for (var i=0;i<entries.length;i++)
+  {
+    var gradientEntry = entries[i];
+    var stop = document.createElementNS(svgNS,'stop');
+	//Set Offset
+	stop.setAttribute('offset', String(gradientEntry.get_ratio() * 100) + '%');
+	//Set Color
+	var color = Number(gradientEntry.get_color()).toString(16);
+	if (color.length == 1) color = '00' + color;
+	if (color.length == 2) color = '00' + color;
+	if (color.length == 4) color = '00' + color;
+	stop.setAttribute('stop-color', '#' + String(color));
+	//Set Alpha
+	stop.setAttribute('stop-opacity', String(gradientEntry.get_alpha()));
+	
+    grad.appendChild(stop);
+  }
+  
+  //Add defs element if not available already
+  //Add newly created gradient to defs element
+  var defs = value.element.querySelector('defs') ||
+      value.element.insertBefore( document.createElementNS(svgNS,'defs'), value.element.firstChild);
+  defs.appendChild(grad);
+  
+  //Return the fill attribute
+  return 'fill:url(#' + gradientId + ')';
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.graphics.LinearGradient.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'LinearGradient', qName: 'org.apache.flex.core.graphics.LinearGradient'}], interfaces: [org.apache.flex.core.graphics.IFill] };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
index ca11b93..20516b0 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
@@ -45,7 +45,7 @@ org.apache.flex.core.graphics.SolidColor = function() {
  */
 org.apache.flex.core.graphics.SolidColor.prototype.FLEXJS_CLASS_INFO =
     { names: [{ name: 'SolidColor',
-                qName: 'org.apache.flex.core.graphics.SolidColor' }] };
+                qName: 'org.apache.flex.core.graphics.SolidColor' }], interfaces: [org.apache.flex.core.graphics.IFill] };
 
 
 /**


[2/7] git commit: [flex-asjs] [refs/heads/develop] - More shapes

Posted by bi...@apache.org.
More shapes


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b330ab16
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b330ab16
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b330ab16

Branch: refs/heads/develop
Commit: b330ab168a0b8ac6183a49e996810d4ce1093f69
Parents: 51d604f
Author: Om <bi...@gmail.com>
Authored: Tue Sep 16 18:16:40 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Tue Sep 16 18:24:45 2014 -0700

----------------------------------------------------------------------
 examples/FlexJSTest_SVG/src/GraphicsView.mxml | 61 ++++++++++++++--------
 1 file changed, 38 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b330ab16/examples/FlexJSTest_SVG/src/GraphicsView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_SVG/src/GraphicsView.mxml b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
index bad453c..61f5723 100644
--- a/examples/FlexJSTest_SVG/src/GraphicsView.mxml
+++ b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
@@ -37,9 +37,8 @@ limitations under the License.
 
 			protected function viewbase1_initCompleteHandler(event:org.apache.flex.events.Event):void
 			{
-				//var d:Dummy = new Dummy();
-				//drawIndividualShapes();
-				drawOnGraphicsContainer();
+				drawIndividualShapes();
+				//drawOnGraphicsContainer();
 			}
 			
 			private function drawIndividualShapes():void
@@ -48,6 +47,18 @@ limitations under the License.
 				fill.color = 0xFF0000;
 				fill.alpha = 0.5;
 				
+				//LinearGradient Fill
+				var lg:LinearGradient = new LinearGradient();
+				lg.entries = [new GradientEntry(1,0xFFFFFF,0), new GradientEntry(1,0x000000,1)];
+				lg.scaleX = 1;
+				lg.rotation = 0;
+				
+				var lg1:LinearGradient = new LinearGradient();
+				lg1.entries = [new GradientEntry(1,0xFF0000,0.33),new GradientEntry(1,0x00FF00,0.66), new GradientEntry(1,0x0000FF,0.99)];
+				lg1.scaleX = 1;
+				lg1.rotation = 90;
+				//container.fill = lg;
+				
 				var stroke:SolidColorStroke = new SolidColorStroke();
 				stroke.weight = 10;
 				stroke.color = 0x00FF00;
@@ -61,7 +72,7 @@ limitations under the License.
 				
 				var rect2:Rect = new Rect();
 				fill.color = 0xCC9900;
-				rect2.fill = fill;
+				rect2.fill = lg1;
 				stroke.color = 0x333333;
 				stroke.weight = 5;
 				rect2.stroke = stroke;
@@ -70,7 +81,7 @@ limitations under the License.
 				
 				var rect3:Rect = new Rect();
 				fill.color = 0xCCCC11;
-				rect3.fill = fill;
+				rect3.fill = lg1;
 				stroke.color = 0x0000CC;
 				stroke.weight = 1;
 				rect3.stroke = stroke;
@@ -88,7 +99,7 @@ limitations under the License.
 				
 				var rect5:Rect = new Rect();
 				fill.color = 0x11CC44;
-				rect5.fill = fill;
+				rect5.fill = lg;
 				stroke.color = 0x830011;
 				stroke.weight = 3;
 				rect5.stroke = stroke;
@@ -97,7 +108,7 @@ limitations under the License.
 				
 				var ellipse1:Ellipse = new Ellipse();
 				fill.color = 0x290149;
-				ellipse1.fill = fill;
+				ellipse1.fill = lg;
 				stroke.color = 0x830011;
 				stroke.weight = 3;
 				ellipse1.stroke = stroke;
@@ -106,7 +117,7 @@ limitations under the License.
 				
 				var ellipse2:Ellipse = new Ellipse();
 				fill.color = 0x2222CC;
-				ellipse2.fill = fill;
+				ellipse2.fill = lg1;
 				stroke.color = 0xabcdef;
 				stroke.weight = 5;
 				ellipse2.stroke = stroke;
@@ -124,7 +135,7 @@ limitations under the License.
 				
 				var circle1:Circle = new Circle();
 				fill.color = 0xee11bb;
-				circle1.fill = fill;
+				circle1.fill = lg1;
 				stroke.color = 0x123456;
 				stroke.weight = 2;
 				circle1.stroke = stroke;
@@ -154,7 +165,7 @@ limitations under the License.
 				var path2:Path = new Path();
 				fill.color = 0x00FF00;
 				fill.alpha = 0.5;
-				path2.fill = fill;
+				path2.fill = lg;
 				stroke.color = 0x0000FF;
 				stroke.weight = 3;
 				path2.stroke = stroke;
@@ -164,7 +175,7 @@ limitations under the License.
 				var path3:Path = new Path();
 				fill.color = 0x00FF00;
 				fill.alpha = 0.5;
-				path3.fill = fill;
+				path3.fill = lg1;
 				stroke.color = 0x0000FF;
 				stroke.weight = 3;
 				path3.stroke = stroke;
@@ -174,18 +185,19 @@ limitations under the License.
 				var path4:Path = new Path();
 				fill.color = 0x00FF00;
 				fill.alpha = 0.5;
-				path4.fill = fill;
+				path4.fill = lg1;
 				stroke.color = 0x0000FF;
 				stroke.weight = 3;
 				path4.stroke = stroke;
 				path4.drawPath(250,500,"M 50 50 L 100 50 A 50 50 0 0 0 50 0 Z");
 				this.addElement(path4);
-				
 			}
 			
 			private function drawOnGraphicsContainer():void
 			{
-				var fill:SolidColor = new SolidColor();
+				var container:GraphicsContainer = new GraphicsContainer();
+				
+/*				var fill:SolidColor = new SolidColor();
 				fill.color = 0xFF0000;
 				fill.alpha = 0.5;
 				
@@ -194,7 +206,6 @@ limitations under the License.
 				stroke.color = 0x00FF00;
 				stroke.alpha = 0.9;
 				
-				var container:GraphicsContainer = new GraphicsContainer();
 				container.fill = fill;
 				container.stroke = stroke;
 				//Circle
@@ -214,7 +225,7 @@ limitations under the License.
 				fill.color = 0x00CCCC;
 				stroke.color = 0x0CCCC0C;
 				stroke.weight = 5;
-				container.drawPath("M 800 800 L 900 800 A 100 100 0 0 0 800 700 Z");
+				container.drawPath("M 800 800 L 900 800 A 100 100 0 0 0 800 700 Z");*/
 				
 				//LinearGradient Fill
 				var lg:LinearGradient = new LinearGradient();
@@ -222,15 +233,19 @@ limitations under the License.
 				lg.scaleX = 1;
 				lg.rotation = 0;
 				container.fill = lg;
-				container.drawRect(20,20,200,100);
-				this.addElement(container);
+				//container.drawRect(20,20,200,100);
 
-				var lg:LinearGradient = new LinearGradient();
-				lg.entries = [new GradientEntry(0.5,0xFFFFFF,0), new GradientEntry(0.9,0x000000,1)];
-				lg.scaleX = 2;
-				lg.rotation = 90;
-				container.fill = lg;
+				//var lg:LinearGradient = new LinearGradient();
+				lg.entries = [new GradientEntry(1,0xFF0000,0.33),new GradientEntry(1,0x00FF00,0.66), new GradientEntry(1,0x0000FF,0.99)];
+				lg.scaleX = 1;
+				lg.rotation = 45;
 				container.drawCircle(400, 400, 300);
+				container.drawPath("M 800 800 L 900 800 A 100 100 0 0 0 800 700 Z");
+				container.drawPath("M 100 350 q 150 -300 300 0");
+				container.drawPath("M 100 100 L 200 100 200 200 100 200 Z");
+				
+				
+				
 				this.addElement(container);
 			}
 			


[6/7] Add support for LinearGradient for AS and JS versions. Includes support for gradient rotation as well. Elliptical Arc (A) property of Path does not support gradient rotations (yet) in the AS version

Posted by bi...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/AdvancedLayoutFeatures.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/AdvancedLayoutFeatures.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/AdvancedLayoutFeatures.as
new file mode 100644
index 0000000..14cc5af
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/AdvancedLayoutFeatures.as
@@ -0,0 +1,1140 @@
+/**
+ * Licensed 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.core.graphics.utils
+{
+	import flash.events.Event;
+	import flash.geom.Matrix;
+	import flash.geom.Matrix3D;
+	import flash.geom.Point;
+	import flash.geom.Vector3D;
+	import flash.system.Capabilities;
+	
+	import org.apache.flex.core.graphics.utils.IAssetLayoutFeatures;
+	
+	
+	/**
+	 *  @private
+	 *  Transform Offsets can be assigned to any Component or GraphicElement to modify the transform
+	 *  of the object beyond where its parent layout places it.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public class AdvancedLayoutFeatures implements IAssetLayoutFeatures
+	{
+		//--------------------------------------------------------------------------
+		//
+		//  Constructor
+		//
+		//--------------------------------------------------------------------------
+		/**
+		 *  Constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function AdvancedLayoutFeatures()
+		{
+			layout = new CompoundTransform();
+		}
+		
+		
+		
+		/**
+		 * @private
+		 * a flag for use by the owning object indicating whether the owning object has a pending update
+		 * to the computed matrix.  it is the owner's responsibility to set this flag.
+		 */
+		public var updatePending:Boolean = false;
+		
+		/**
+		 * storage for the depth value. Layering is considered 'advanced' layout behavior, and not something
+		 * that gets used by the majority of the components out there.  So if a component has a non-zero depth,
+		 * it will allocate a AdvancedLayoutFeatures object and store the value here.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public var depth:Number = 0;
+		
+		/**
+		 * @private
+		 * slots for the various 2D and 3D matrices for layout, offset, and computed transforms.  Note that 
+		 * these are only allocated and computed on demand -- many component instances will never use a 3D
+		 * matrix, for example. 
+		 */
+		protected var _computedMatrix:Matrix;
+		protected var _computedMatrix3D:Matrix3D;
+		
+		/**
+		 * @private
+		 * the layout visible transform as defined by the user and parent layout.
+		 */
+		protected var layout:CompoundTransform;
+		
+		/**
+		 * @private
+		 * offset values applied by the user
+		 */
+		private var _postLayoutTransformOffsets:TransformOffsets;
+		
+		/**
+		 * @private
+		 * bit field flags for indicating which transforms are valid -- the layout properties, the matrices,
+		 * and the 3D matrices.  Since developers can set any of the three programmatically, the last one set
+		 * will always be valid, and the others will be invalid until validated on demand.
+		 */
+		private static const COMPUTED_MATRIX_VALID:uint     = 0x1;
+		private static const COMPUTED_MATRIX3D_VALID:uint   = 0x2;
+		
+		/**
+		 * @private
+		 * general storage for all of our flags.  
+		 */
+		private var _flags:uint = 0;
+		
+		/**
+		 * @private
+		 * static data used by utility methods below
+		 */
+		private static var reVT:Vector3D = new Vector3D(0,0,0);
+		private static var reVR:Vector3D = new Vector3D(0,0,0);
+		private static var reVS:Vector3D = new Vector3D(1,1,1);
+		
+		private static var reV:Vector.<Vector3D> = new Vector.<Vector3D>();
+		reV.push(reVT);
+		reV.push(reVR);
+		reV.push(reVS);
+		
+		
+		private static const RADIANS_PER_DEGREES:Number = Math.PI / 180;
+		
+		private static const ZERO_REPLACEMENT_IN_3D:Number = .00000000000001;
+		
+		private static var tempLocalPosition:Vector3D;
+		
+		/**
+		 * @private
+		 * a pointer to the function we use to transform vectors, to work around a bug
+		 * in early versions of the flash player.
+		 */
+		private static var transformVector:Function = initTransformVectorFunction;
+		
+		/**
+		 * @private
+		 * an actionscript implementation to transform a vector by a matrix. Bugs in early versions of 
+		 * flash 10's implementation of Matrix.transformVector force us to do it ourselves in actionscript. 
+		 */
+		private static function pre10_0_22_87_transformVector(m:Matrix3D,v:Vector3D):Vector3D
+		{
+			var r:Vector.<Number> = m.rawData;
+			return new Vector3D(
+				r[0] * v.x + r[4] * v.y + r[8] * v.z + r[12], 
+				r[1] * v.x + r[5] * v.y + r[9] * v.z + r[13], 
+				r[2] * v.x + r[6] * v.y + r[10] * v.z + r[14],
+				1); 
+		}
+		
+		/**
+		 * @private
+		 * a  function to transform vectors using the built in player API, if we're in a late enough player version
+		 * that we won't run into bugs.s
+		 */
+		private static function nativeTransformVector(m:Matrix3D,v:Vector3D):Vector3D
+		{
+			return m.transformVector(v);
+		}
+		
+		/**
+		 * @private
+		 * the first time someone calls transformVector, they'll get this function.  It checks the player version,
+		 * and if decides which implementation to use based on whether a bug is present or not.
+		 */
+		private static function initTransformVectorFunction(m:Matrix3D,v:Vector3D):Vector3D
+		{
+			var canUseNative:Boolean = false;
+			var version:Array = Capabilities.version.split(' ')[1].split(',');
+			if (parseFloat(version[0]) > 10)
+				canUseNative  = true;
+			else if (parseFloat(version[1]) > 0)
+				canUseNative  = true;
+			else if (parseFloat(version[2]) > 22)
+				canUseNative  = true;
+			else if (parseFloat(version[3]) >= 87)
+				canUseNative  = true;
+			if (canUseNative)
+				transformVector = nativeTransformVector;
+			else
+				transformVector = pre10_0_22_87_transformVector;
+			
+			return transformVector(m,v);
+		}
+		
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 * layout transform convenience property.  Represents the x value of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutX(value:Number):void
+		{
+			layout.x = value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutX():Number
+		{
+			return layout.x;
+		}
+		/**
+		 * layout transform convenience property.  Represents the y value of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutY(value:Number):void
+		{
+			layout.y = value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutY():Number
+		{
+			return layout.y;
+		}
+		
+		/**
+		 * layout transform convenience property.  Represents the z value of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutZ(value:Number):void
+		{
+			layout.z = value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutZ():Number
+		{
+			return layout.z;
+		}
+		
+		//----------------------------------
+		//  layoutWidth
+		//----------------------------------
+		
+		private var _layoutWidth:Number = 0;
+		
+		/**
+		 *  Used by the mirroring transform.   See the mirror property.
+		 *  @default 0
+		 */
+		public function get layoutWidth():Number
+		{
+			return _layoutWidth;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set layoutWidth(value:Number):void
+		{
+			if (value == _layoutWidth)
+				return;
+			_layoutWidth = value;
+			invalidate();
+		}
+		
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 * @private
+		 * the x value of the point around which any rotation and scale is performed in both the layout and computed matrix.
+		 */
+		public function set transformX(value:Number):void
+		{
+			layout.transformX = value;
+			invalidate();
+		}
+		/**
+		 * @private
+		 */
+		public function get transformX():Number
+		{
+			return layout.transformX;
+		}
+		
+		/**
+		 * @private
+		 * the y value of the point around which any rotation and scale is performed in both the layout and computed matrix.
+		 */
+		public function set transformY(value:Number):void
+		{
+			layout.transformY = value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get transformY():Number
+		{
+			return layout.transformY;
+		}
+		
+		/**
+		 * @private
+		 * the z value of the point around which any rotation and scale is performed in both the layout and computed matrix.
+		 */
+		public function set transformZ(value:Number):void
+		{
+			layout.transformZ = value;  
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get transformZ():Number
+		{
+			return layout.transformZ;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		
+		/**
+		 * layout transform convenience property.  Represents the rotation around the X axis of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutRotationX(value:Number):void
+		{
+			layout.rotationX= value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutRotationX():Number
+		{
+			return layout.rotationX;
+		}
+		
+		/**
+		 * layout transform convenience property.  Represents the rotation around the Y axis of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutRotationY(value:Number):void
+		{
+			layout.rotationY= value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutRotationY():Number
+		{
+			return layout.rotationY;
+		}
+		
+		/**
+		 * layout transform convenience property.  Represents the rotation around the Z axis of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutRotationZ(value:Number):void
+		{
+			layout.rotationZ= value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutRotationZ():Number
+		{
+			return layout.rotationZ;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		
+		/**
+		 * layout transform convenience property.  Represents the scale along the X axis of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutScaleX(value:Number):void
+		{
+			layout.scaleX = value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutScaleX():Number
+		{
+			return layout.scaleX;
+		}
+		
+		/**
+		 * layout transform convenience property.  Represents the scale along the Y axis of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutScaleY(value:Number):void
+		{
+			layout.scaleY= value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutScaleY():Number
+		{
+			return layout.scaleY;
+		}
+		
+		
+		/**
+		 * layout transform convenience property.  Represents the scale along the Z axis of the layout matrix used in layout and in 
+		 * the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set layoutScaleZ(value:Number):void
+		{
+			layout.scaleZ= value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutScaleZ():Number
+		{
+			return layout.scaleZ;
+		}
+		
+		/**
+		 * @private
+		 * The 2D matrix used during layout calculations to determine the layout and size of the component and its parent and siblings.
+		 * If the convenience properties are set, this matrix is built from those properties.  
+		 * If the matrix is set directly, the convenience properties will be updated to values derived from this matrix.
+		 * This matrix is used in the calculation of the computed transform if possible. Under certain circumstances, such as when 
+		 * offsets are provided, the decomposed layout properties will be used instead.
+		 */
+		public function set layoutMatrix(value:Matrix):void
+		{
+			layout.matrix = value;
+			invalidate();
+		}
+		
+		
+		/**
+		 * @private
+		 */
+		public function get layoutMatrix():Matrix
+		{
+			return layout.matrix;
+			
+		}
+		
+		
+		/**
+		 * @private
+		 * The 3D matrix used during layout calculations to determine the layout and size of the component and its parent and siblings.
+		 * This matrix is only used by parents that respect 3D layoyut.
+		 * If the convenience properties are set, this matrix is built from those properties.  
+		 * If the matrix is set directly, the convenience properties will be updated to values derived from this matrix.
+		 * This matrix is used in the calculation of the computed transform if possible. Under certain circumstances, such as when 
+		 * offsets are provided, the decomposed layout properties will be used instead.
+		 */
+		public function set layoutMatrix3D(value:Matrix3D):void
+		{
+			layout.matrix3D = value;
+			invalidate();
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get layoutMatrix3D():Matrix3D
+		{
+			return layout.matrix3D;
+		}
+		
+		/**
+		 * true if the computed transform has 3D values.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function get is3D():Boolean
+		{
+			return (layout.is3D || (postLayoutTransformOffsets != null && postLayoutTransformOffsets.is3D));
+		}
+		
+		/**
+		 * true if the layout transform has 3D values.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function get layoutIs3D():Boolean
+		{
+			return layout.is3D;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		/** offsets to the transform convenience properties that are applied when a component is rendered. If this 
+		 * property is set, its values will be added to the layout transform properties to determine the true matrix used to render
+		 * the component
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set postLayoutTransformOffsets(value:TransformOffsets):void
+		{
+			if (_postLayoutTransformOffsets != null)
+			{
+				_postLayoutTransformOffsets.removeEventListener(Event.CHANGE,postLayoutTransformOffsetsChangedHandler);
+				_postLayoutTransformOffsets.owner = null;
+			}
+			_postLayoutTransformOffsets = value;
+			if (_postLayoutTransformOffsets != null)
+			{
+				_postLayoutTransformOffsets.addEventListener(Event.CHANGE,postLayoutTransformOffsetsChangedHandler);
+				_postLayoutTransformOffsets.owner = this;
+			}
+			invalidate();       
+		}
+		
+		public function get postLayoutTransformOffsets():TransformOffsets
+		{
+			return _postLayoutTransformOffsets;
+		}
+		
+		private function postLayoutTransformOffsetsChangedHandler(e:Event):void
+		{
+			invalidate();       
+		}
+		
+		//----------------------------------
+		//  mirror
+		//----------------------------------
+		
+		private var _mirror:Boolean = false;
+		
+		/**
+		 *  If true the X axis is scaled by -1 and the x coordinate of the origin
+		 *  is translated by the component's width.  
+		 * 
+		 *  The net effect of this "mirror" transform is to flip the direction 
+		 *  that the X axis increases in without changing the layout element's 
+		 *  location relative to the parent's origin.
+		 * 
+		 *  @default false
+		 */
+		public function get mirror():Boolean
+		{
+			return _mirror;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set mirror(value:Boolean):void
+		{
+			_mirror = value;
+			invalidate();
+		}
+		
+		
+		//----------------------------------
+		//  stretchX
+		//----------------------------------
+		
+		private var _stretchX:Number = 1;
+		
+		/**
+		 *  The stretchY is the horizontal component of the stretch scale factor which
+		 *  is applied before any other transformation property.
+		 *  @default 1
+		 */
+		public function get stretchX():Number
+		{
+			return _stretchX;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set stretchX(value:Number):void
+		{
+			if (value == _stretchX)
+				return;         
+			_stretchX = value;
+			invalidate();
+		}
+		
+		//----------------------------------
+		//  stretchY
+		//----------------------------------
+		
+		private var _stretchY:Number = 1;
+		
+		/**
+		 *  The stretchY is the vertical component of the stretch scale factor which
+		 *  is applied before any other transformation property.
+		 *  @default 1
+		 */
+		public function get stretchY():Number
+		{
+			return _stretchY;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set stretchY(value:Number):void
+		{
+			if (value == _stretchY)
+				return;         
+			_stretchY = value;
+			invalidate();
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 * @private
+		 * invalidates our various cached values.  Any change to the AdvancedLayoutFeatures object that affects
+		 * the various transforms should call this function.    
+		 * @param reason - the code indicating what changes to cause the invalidation.
+		 * @param affects3D - a flag indicating whether the change affects the 2D/3D nature of the various transforms.
+		 * @param dispatchChangeEvent - if true, the AdvancedLayoutFeatures will dispatch a change indicating that its underlying transforms
+		 * have been modified. 
+		 */
+		private function invalidate():void
+		{                       
+			_flags &= ~COMPUTED_MATRIX_VALID;
+			_flags &= ~COMPUTED_MATRIX3D_VALID;
+		}
+		
+		
+		/**
+		 * the computed matrix, calculated by combining the layout matrix and  and any offsets provided..
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function get computedMatrix():Matrix
+		{
+			if (_flags & COMPUTED_MATRIX_VALID)
+				return _computedMatrix;
+			
+			if (!postLayoutTransformOffsets && !mirror && stretchX == 1 && stretchY == 1)
+			{
+				return layout.matrix;
+			}           
+			
+			var m:Matrix = _computedMatrix;
+			if (m == null)
+				m = _computedMatrix = new Matrix();
+			else
+				m.identity();
+			
+			var tx:Number = layout.transformX;
+			var ty:Number = layout.transformY;
+			var sx:Number = layout.scaleX;
+			var sy:Number = layout.scaleY;
+			var rz:Number = layout.rotationZ;
+			var x:Number = layout.x;
+			var y:Number = layout.y;
+			
+			if (mirror)
+			{
+				sx *= -1;
+				x += layoutWidth;
+			}
+			
+			if (postLayoutTransformOffsets)
+			{
+				sx *= postLayoutTransformOffsets.scaleX;
+				sy *= postLayoutTransformOffsets.scaleY;
+				rz += postLayoutTransformOffsets.rotationZ;
+				x += postLayoutTransformOffsets.x;
+				y += postLayoutTransformOffsets.y;
+			}
+			
+			if (stretchX != 1 || stretchY != 1)
+				m.scale(stretchX, stretchY);
+			build2DMatrix(m, tx, ty, sx, sy, rz, x, y);
+			
+			_flags |= COMPUTED_MATRIX_VALID;
+			return m;
+		}
+		
+		/**
+		 * the computed 3D matrix, calculated by combining the 3D layout matrix and  and any offsets provided..
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function get computedMatrix3D():Matrix3D
+		{
+			if (_flags & COMPUTED_MATRIX3D_VALID)
+				return _computedMatrix3D;
+			
+			
+			if (!postLayoutTransformOffsets && !mirror && stretchX == 1 && stretchY == 1)
+			{
+				return layout.matrix3D;
+			}
+			
+			var m:Matrix3D = _computedMatrix3D;
+			if (m == null)
+				m = _computedMatrix3D = new Matrix3D();
+			else
+				m.identity();
+			
+			var tx:Number = layout.transformX;
+			var ty:Number = layout.transformY;
+			var tz:Number = layout.transformZ;
+			var sx:Number = layout.scaleX;
+			var sy:Number = layout.scaleY;
+			var sz:Number = layout.scaleZ;
+			var rx:Number = layout.rotationX;
+			var ry:Number = layout.rotationY;
+			var rz:Number = layout.rotationZ;
+			var x:Number = layout.x;
+			var y:Number = layout.y;
+			var z:Number = layout.z;
+			
+			if (mirror)
+			{
+				sx *= -1;
+				x += layoutWidth;
+			}
+			
+			if (postLayoutTransformOffsets)
+			{
+				sx *= postLayoutTransformOffsets.scaleX;
+				sy *= postLayoutTransformOffsets.scaleY;
+				sz *= postLayoutTransformOffsets.scaleZ;
+				rx += postLayoutTransformOffsets.rotationX;
+				ry += postLayoutTransformOffsets.rotationY;
+				rz += postLayoutTransformOffsets.rotationZ;
+				x += postLayoutTransformOffsets.x;
+				y += postLayoutTransformOffsets.y;
+				z += postLayoutTransformOffsets.z;
+			}
+			
+			build3DMatrix(m, tx, ty, tz, sx, sy, sz, rx, ry, rz, x, y, z);
+			// Always prepend last
+			if (stretchX != 1 || stretchY != 1)
+				m.prependScale(stretchX, stretchY, 1);  
+			
+			_flags |= COMPUTED_MATRIX3D_VALID;
+			return m;           
+		}
+		
+		
+		/**
+		 * @private
+		 * convenience function for building a 2D matrix from the convenience properties 
+		 */
+		public static function build2DMatrix(m:Matrix,
+											 tx:Number,ty:Number,
+											 sx:Number,sy:Number,
+											 rz:Number,
+											 x:Number,y:Number):void
+		{
+			m.translate(-tx,-ty);
+			m.scale(sx,sy);
+			m.rotate(rz* RADIANS_PER_DEGREES);
+			m.translate(x+tx,y+ty);         
+		}
+		
+		
+		/**
+		 * @private
+		 * convenience function for building a 3D matrix from the convenience properties 
+		 */
+		public static function build3DMatrix(m:Matrix3D,
+											 tx:Number,ty:Number,tz:Number,
+											 sx:Number,sy:Number,sz:Number,
+											 rx:Number,ry:Number,rz:Number,
+											 x:Number,y:Number,z:Number):void
+		{
+			reVR.x = rx * RADIANS_PER_DEGREES;
+			reVR.y = ry * RADIANS_PER_DEGREES;
+			reVR.z = rz * RADIANS_PER_DEGREES;
+			m.recompose(reV);
+			if (sx == 0)
+				sx = ZERO_REPLACEMENT_IN_3D;
+			if (sy == 0)
+				sy = ZERO_REPLACEMENT_IN_3D;
+			if (sz == 0)
+				sz = ZERO_REPLACEMENT_IN_3D;
+			m.prependScale(sx,sy,sz);
+			m.prependTranslation(-tx,-ty,-tz);
+			m.appendTranslation(tx+x,ty+y,tz+z);
+		}                                   
+		
+		
+		/**
+		 * A utility method to transform a point specified in the local
+		 * coordinates of this object to its location in the object's parent's 
+		 * coordinates. The pre-layout and post-layout result will be set on 
+		 * the <code>position</code> and <code>postLayoutPosition</code>
+		 * parameters, if they are non-null.
+		 * 
+		 * @param propertyIs3D A boolean reflecting whether the calculation needs
+		 * to take into account the 3D matrix of the object.
+		 * @param localPoint The point to be transformed, specified in the
+		 * local coordinates of the object.
+		 * @position A Vector3D point that will hold the pre-layout
+		 * result. If null, the parameter is ignored.
+		 * @postLayoutPosition A Vector3D point that will hold the post-layout
+		 * result. If null, the parameter is ignored.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function transformPointToParent(propertyIs3D:Boolean,
+											   localPosition:Vector3D, position:Vector3D,
+											   postLayoutPosition:Vector3D):void
+		{
+			var transformedV:Vector3D;
+			var transformedP:Point;
+			tempLocalPosition = 
+				localPosition ?
+				localPosition.clone() :
+				new Vector3D();
+			
+			if (is3D || propertyIs3D) 
+			{
+				if (position != null)
+				{
+					transformedV = transformVector(layoutMatrix3D, tempLocalPosition); 
+					position.x = transformedV.x;
+					position.y = transformedV.y;
+					position.z = transformedV.z;
+				} 
+				
+				if (postLayoutPosition != null)
+				{           
+					// computedMatrix factor in stretchXY, so divide it out of position first
+					tempLocalPosition.x /= stretchX;
+					tempLocalPosition.y /= stretchY;
+					transformedV = transformVector(computedMatrix3D, tempLocalPosition);
+					postLayoutPosition.x = transformedV.x;
+					postLayoutPosition.y = transformedV.y;
+					postLayoutPosition.z = transformedV.z;
+				}
+			}
+			else
+			{
+				var localP:Point = new Point(tempLocalPosition.x, 
+					tempLocalPosition.y);
+				if (position != null)
+				{
+					transformedP = layoutMatrix.transformPoint(localP);
+					position.x = transformedP.x;
+					position.y = transformedP.y;
+					position.z = 0;
+				}
+				
+				if (postLayoutPosition != null)
+				{
+					// computedMatrix factor in stretchXY, so divide it out of position first
+					localP.x /= stretchX;
+					localP.y /= stretchY;
+					transformedP = computedMatrix.transformPoint(localP);
+					postLayoutPosition.x = transformedP.x;
+					postLayoutPosition.y = transformedP.y;
+					postLayoutPosition.z = 0;
+				}
+			}
+		}
+		
+		/**
+		 * @private
+		 * call when you've changed the inputs to the computed transform to make 
+		 * any adjustments to keep a particular point fixed in parent coordinates.
+		 */
+		private function completeTransformCenterAdjustment(changeIs3D:Boolean, 
+														   transformCenter:Vector3D, targetPosition:Vector3D,
+														   targetPostLayoutPosition:Vector3D):void
+		{
+			// TODO (chaase): optimize for transformCenter == (0,0,0)
+			if (is3D || changeIs3D)
+			{
+				if (targetPosition != null)
+				{
+					var adjustedLayoutCenterV:Vector3D = transformVector(layoutMatrix3D, transformCenter); 
+					if (adjustedLayoutCenterV.equals(targetPosition) == false)
+					{
+						layout.translateBy(targetPosition.x - adjustedLayoutCenterV.x,
+							targetPosition.y - adjustedLayoutCenterV.y, 
+							targetPosition.z - adjustedLayoutCenterV.z);
+						invalidate(); 
+					}       
+				}
+				if (targetPostLayoutPosition != null && _postLayoutTransformOffsets != null)
+				{
+					// computedMatrix factor in stretchXY, so divide it out of transform center first
+					var tmpPos:Vector3D = new Vector3D(transformCenter.x, transformCenter.y, transformCenter.z);
+					tmpPos.x /= stretchX;
+					tmpPos.y /= stretchY;
+					var adjustedComputedCenterV:Vector3D = transformVector(computedMatrix3D, tmpPos);
+					if (adjustedComputedCenterV.equals(targetPostLayoutPosition) == false)
+					{
+						postLayoutTransformOffsets.x +=targetPostLayoutPosition.x - adjustedComputedCenterV.x;
+						postLayoutTransformOffsets.y += targetPostLayoutPosition.y - adjustedComputedCenterV.y;
+						postLayoutTransformOffsets.z += targetPostLayoutPosition.z - adjustedComputedCenterV.z;
+						invalidate(); 
+					}       
+				}
+			}
+			else
+			{
+				var transformCenterP:Point = new Point(transformCenter.x,transformCenter.y);
+				if (targetPosition != null)
+				{
+					var currentPositionP:Point = layoutMatrix.transformPoint(transformCenterP);
+					if (currentPositionP.x != targetPosition.x || 
+						currentPositionP.y != targetPosition.y)
+					{
+						layout.translateBy(targetPosition.x - currentPositionP.x,
+							targetPosition.y - currentPositionP.y, 0);
+						invalidate(); 
+					}       
+				}
+				
+				if (targetPostLayoutPosition != null && _postLayoutTransformOffsets != null)
+				{           
+					// computedMatrix factor in stretchXY, so divide it out of transform center first
+					transformCenterP.x /= stretchX;
+					transformCenterP.y /= stretchY;
+					var currentPostLayoutPosition:Point = 
+						computedMatrix.transformPoint(transformCenterP);
+					if (currentPostLayoutPosition.x != targetPostLayoutPosition.x || 
+						currentPostLayoutPosition.y != targetPostLayoutPosition.y)
+					{
+						_postLayoutTransformOffsets.x += targetPostLayoutPosition.x - currentPostLayoutPosition.x;
+						_postLayoutTransformOffsets.y += targetPostLayoutPosition.y - currentPostLayoutPosition.y;
+						invalidate(); 
+					}       
+				}
+			}
+		}   
+		
+		private static var staticTranslation:Vector3D = new Vector3D();
+		private static var staticOffsetTranslation:Vector3D = new Vector3D();
+		
+		/**
+		 * A utility method to update the rotation and scale of the transform 
+		 * while keeping a particular point, specified in the component's own 
+		 * coordinate space, fixed in the parent's coordinate space.  This 
+		 * function will assign the rotation and scale values provided, then 
+		 * update the x/y/z properties as necessary to keep tx/ty/tz fixed.
+		 * @param transformCenter the point, in the component's own coordinates, 
+		 * to keep fixed relative to its parent.
+		 * @param rotation the new values for the rotation of the transform
+		 * @param scale the new values for the scale of the transform
+		 * @param translation the new values for the translation of the transform
+		 */
+		public function transformAround(transformCenter:Vector3D,
+										scale:Vector3D,
+										rotation:Vector3D,
+										transformCenterPosition:Vector3D,
+										postLayoutScale:Vector3D = null,
+										postLayoutRotation:Vector3D = null,
+										postLayoutTransformCenterPosition:Vector3D = null):void
+		{
+			var is3D:Boolean = (scale != null && scale.z != 1) ||
+				(rotation != null && ((rotation.x != 0 ) || (rotation.y != 0))) || 
+				(transformCenterPosition != null && transformCenterPosition.z != 0) ||
+				(postLayoutScale != null && postLayoutScale.z != 1) ||
+				(postLayoutRotation != null && 
+					(postLayoutRotation.x != 0 || postLayoutRotation.y != 0)) || 
+				(postLayoutTransformCenterPosition != null && postLayoutTransformCenterPosition.z != 0);
+			
+			var needOffsets:Boolean = _postLayoutTransformOffsets == null && 
+				(postLayoutScale != null || postLayoutRotation != null || 
+					postLayoutTransformCenterPosition != null);
+			if (needOffsets)
+				_postLayoutTransformOffsets = new TransformOffsets();                                               
+			
+			// now if they gave us a non-trivial transform center, and didn't tell us where they want it, 
+			// we need to calculate where it is so that we can make sure we keep it there.             
+			if (transformCenter != null && 
+				(transformCenterPosition == null || postLayoutTransformCenterPosition == null))
+			{           
+				transformPointToParent(is3D, transformCenter, staticTranslation,
+					staticOffsetTranslation);
+				if (postLayoutTransformCenterPosition == null && transformCenterPosition != null)
+				{
+					staticOffsetTranslation.x = transformCenterPosition.x + staticOffsetTranslation.x - staticTranslation.x;
+					staticOffsetTranslation.y = transformCenterPosition.y + staticOffsetTranslation.y - staticTranslation.y;
+					staticOffsetTranslation.z = transformCenterPosition.z + staticOffsetTranslation.z - staticTranslation.z;
+				}
+				
+			}
+			// if targetPosition/postLayoutTargetPosition is null here, it might be because the caller passed in
+			// requested values, so we haven't calculated it yet.  So that means our target position is the values
+			// they passed in.        
+			var targetPosition:Vector3D = (transformCenterPosition == null)? staticTranslation:transformCenterPosition;
+			var postLayoutTargetPosition:Vector3D = (postLayoutTransformCenterPosition == null)? staticOffsetTranslation:postLayoutTransformCenterPosition;
+			
+			// now update our transform values.     
+			if (rotation != null)
+			{
+				if (!isNaN(rotation.x))
+					layout.rotationX = rotation.x;
+				if (!isNaN(rotation.y))
+					layout.rotationY = rotation.y;
+				if (!isNaN(rotation.z))
+					layout.rotationZ = rotation.z;
+			}
+			if (scale != null)
+			{           
+				if (!isNaN(scale.x))
+					layout.scaleX = scale.x;
+				if (!isNaN(scale.y))
+					layout.scaleY = scale.y;
+				if (!isNaN(scale.z))
+					layout.scaleZ = scale.z;
+			}
+			
+			if (postLayoutRotation != null)
+			{           
+				_postLayoutTransformOffsets.rotationX = postLayoutRotation.x;
+				_postLayoutTransformOffsets.rotationY = postLayoutRotation.y;
+				_postLayoutTransformOffsets.rotationZ = postLayoutRotation.z;
+			}
+			if (postLayoutScale != null)
+			{           
+				_postLayoutTransformOffsets.scaleX = postLayoutScale.x;
+				_postLayoutTransformOffsets.scaleY = postLayoutScale.y;
+				_postLayoutTransformOffsets.scaleZ = postLayoutScale.z;
+			}
+			
+			// if they didn't pass us a transform center, 
+			// then we assume it's the origin. In that case, it's trivially easy
+			// to make sure the origin is at a particular point...we simply set 
+			// the transformCenterPosition portion of our transforms to that point. 
+			if (transformCenter == null)
+			{
+				if (transformCenterPosition != null)
+				{
+					layout.x = transformCenterPosition.x;
+					layout.y = transformCenterPosition.y;
+					layout.z = transformCenterPosition.z;
+				}
+				if (postLayoutTransformCenterPosition != null)
+				{
+					_postLayoutTransformOffsets.x = postLayoutTransformCenterPosition.x - layout.x;
+					_postLayoutTransformOffsets.y = postLayoutTransformCenterPosition.y - layout.y;
+					_postLayoutTransformOffsets.z = postLayoutTransformCenterPosition.z - layout.z;
+				}
+			}
+			invalidate();
+			
+			// if they did pass in a transform center, go do the adjustments necessary to keep it fixed in place.
+			if (transformCenter != null)
+				completeTransformCenterAdjustment(is3D, transformCenter, 
+					targetPosition, postLayoutTargetPosition);
+			
+			
+		}
+		
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/CompoundTransform.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/CompoundTransform.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/CompoundTransform.as
new file mode 100644
index 0000000..7b1916b
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/CompoundTransform.as
@@ -0,0 +1,777 @@
+/**
+ * Licensed 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.core.graphics.utils
+{
+	import flash.geom.Matrix;
+	import flash.geom.Matrix3D;
+	import flash.geom.Vector3D;
+	
+	import __AS3__.vec.Vector;
+	
+	/**
+	 *  A CompoundTransform represents a 2D or 3D matrix transform.  A compound transform represents a matrix that can be queried or set either as a 2D matrix,
+	 *  a 3D matrix, or as individual convenience transform properties such as x, y, scaleX, rotationZ, etc. 
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public class CompoundTransform
+	{
+		//--------------------------------------------------------------------------
+		//
+		//  Constructor
+		//
+		//--------------------------------------------------------------------------
+		/**
+		 *  Constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function CompoundTransform()
+		{
+		}
+		
+		
+		
+		/**
+		 * @private
+		 * storage for transform properties. These values are concatenated together with the layout properties to
+		 * form the actual computed matrix used to render the object.
+		 */
+		private var _rotationX:Number = 0;
+		private var _rotationY:Number = 0;
+		private var _rotationZ:Number = 0;
+		private var _scaleX:Number = 1;
+		private var _scaleY:Number = 1;
+		private var _scaleZ:Number = 1;     
+		private var _x:Number = 0;
+		private var _y:Number = 0;
+		private var _z:Number = 0;
+		
+		private var _transformX:Number = 0;
+		private var _transformY:Number = 0;
+		private var _transformZ:Number = 0;
+		
+		
+		/**
+		 * @private
+		 * slots for the 2D and 3D matrix transforms.  Note that 
+		 * these are only allocated and computed on demand -- many component instances will never use a 3D
+		 * matrix, for example. 
+		 */
+		private var _matrix:Matrix;
+		private var _matrix3D:Matrix3D;
+		
+		
+		/**
+		 * @private
+		 * bit field flags for indicating which transforms are valid -- the layout properties, the matrices,
+		 * and the 3D matrices.  Since developers can set any of the three programmatically, the last one set
+		 * will always be valid, and the others will be invalid until validated on demand.
+		 */
+		private static const MATRIX_VALID:uint      = 0x20;
+		private static const MATRIX3D_VALID:uint        = 0x40;
+		private static const PROPERTIES_VALID:uint  = 0x80;
+		
+		
+		/**
+		 * @private
+		 * flags for tracking whether the  transform is 3D. A transform is 3D if any of the 3D properties -- rotationX/Y, scaleZ, or z -- are set.
+		 */
+		private static const IS_3D:uint                 = 0x200;
+		private static const M3D_FLAGS_VALID:uint           = 0x400;
+		
+		/**
+		 * @private
+		 * constants to indicate which form of a transform -- the properties, matrix, or matrix3D -- is
+		 *  'the source of truth.'   
+		 */
+		public static const SOURCE_PROPERTIES:uint          = 1;
+		/**
+		 * @private
+		 * constants to indicate which form of a transform -- the properties, matrix, or matrix3D -- is
+		 *  'the source of truth.'   
+		 */
+		public static const SOURCE_MATRIX:uint          = 2;
+		/**
+		 * @private
+		 * constants to indicate which form of a transform -- the properties, matrix, or matrix3D -- is
+		 *  'the source of truth.'   
+		 */
+		public static const SOURCE_MATRIX3D:uint            = 3;
+		
+		/**
+		 * @private
+		 * indicates the 'source of truth' for the transform.  
+		 */
+		public var sourceOfTruth:uint = SOURCE_PROPERTIES;
+		
+		/**
+		 * @private
+		 * general storage for all of ur flags.  
+		 */
+		private var _flags:uint =  PROPERTIES_VALID;
+		
+		/**
+		 * @private
+		 * flags that get passed to the invalidate method indicating why the invalidation is happening.
+		 */
+		private static const INVALIDATE_FROM_NONE:uint =            0;                      
+		private static const INVALIDATE_FROM_PROPERTY:uint =        4;                      
+		private static const INVALIDATE_FROM_MATRIX:uint =          5;                      
+		private static const INVALIDATE_FROM_MATRIX3D:uint =        6;                      
+		
+		/**
+		 * @private
+		 * static data used by utility methods below
+		 */
+		private static var decomposition:Vector.<Number> = new Vector.<Number>();
+		decomposition.push(0);
+		decomposition.push(0);
+		decomposition.push(0);
+		decomposition.push(0);
+		decomposition.push(0);
+		
+		private static const RADIANS_PER_DEGREES:Number = Math.PI / 180;
+		
+		//----------------------------------------------------------------------------
+		
+		/**
+		 *  The x value of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set x(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _x)
+				return;
+			translateBy(value-_x,0,0);
+			invalidate(INVALIDATE_FROM_PROPERTY, false /*affects3D*/);
+		}
+		/**
+		 * @private
+		 */
+		public function get x():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _x;
+		}
+		
+		/**
+		 *  The y value of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set y(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _y)
+				return;
+			translateBy(0,value-_y,0);
+			invalidate(INVALIDATE_FROM_PROPERTY, false /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get y():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _y;
+		}
+		
+		/**
+		 *  The z value of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set z(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _z)
+				return;
+			translateBy(0,0,value-_z);
+			invalidate(INVALIDATE_FROM_PROPERTY, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get z():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _z;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		
+		/**
+		 *  The rotationX, in degrees, of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set rotationX(value:Number):void
+		{
+			// clamp the rotation value between -180 and 180.  This is what 
+			// the Flash player does, so let's mimic it here too.
+			value = MatrixUtil.clampRotation(value);
+			
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _rotationX)
+				return;
+			_rotationX = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get rotationX():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _rotationX;
+		}
+		
+		/**
+		 *  The rotationY, in degrees, of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set rotationY(value:Number):void
+		{
+			// clamp the rotation value between -180 and 180.  This is what 
+			// the Flash player does, so let's mimic it here too.
+			value = MatrixUtil.clampRotation(value);
+			
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _rotationY)
+				return;
+			_rotationY = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get rotationY():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _rotationY;
+		}
+		
+		/**
+		 *  The rotationZ, in degrees, of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set rotationZ(value:Number):void
+		{
+			// clamp the rotation value between -180 and 180.  This is what 
+			// the Flash player does, so let's mimic it here too.
+			value = MatrixUtil.clampRotation(value);
+			
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _rotationZ)
+				return;
+			_rotationZ = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, false /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get rotationZ():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _rotationZ;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		
+		/**
+		 *  The scaleX of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set scaleX(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _scaleX)
+				return;
+			_scaleX = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, false /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get scaleX():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _scaleX;
+		}
+		
+		/**
+		 *  The scaleY of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set scaleY(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _scaleY)
+				return;
+			_scaleY = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, false /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get scaleY():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _scaleY;
+		}
+		
+		
+		/**
+		 *  The scaleZ of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set scaleZ(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _scaleZ)
+				return;
+			_scaleZ = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get scaleZ():Number
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			return _scaleZ;
+		}
+		
+		
+		/**
+		 * @private
+		 * returns true if the transform has 3D values.
+		 */
+		public function get is3D():Boolean
+		{
+			if ((_flags & M3D_FLAGS_VALID) == 0)
+				update3DFlags();
+			return ((_flags & IS_3D) != 0);
+		}
+		
+		//------------------------------------------------------------------------------
+		/**
+		 *  The x value of the transform center. The transform center is kept fixed as rotation and scale are applied. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set transformX(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _transformX)
+				return;
+			_transformX = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get transformX():Number
+		{
+			return _transformX;
+		}
+		
+		//------------------------------------------------------------------------------
+		/**
+		 *  The y value of the tansform center. The transform center is kept fixed as rotation and scale are applied. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set transformY(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _transformY)
+				return;
+			_transformY = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get transformY():Number
+		{
+			return _transformY;
+		}
+		//------------------------------------------------------------------------------
+		/**
+		 *  The z value of the tansform center. The transform center is kept fixed as rotation and scale are applied. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set transformZ(value:Number):void
+		{
+			if ((_flags & PROPERTIES_VALID) == false) validatePropertiesFromMatrix();
+			if (value == _transformZ)
+				return;
+			_transformZ = value;
+			invalidate(INVALIDATE_FROM_PROPERTY, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get transformZ():Number
+		{
+			return _transformZ;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 * @private
+		 * invalidates our various cached values.  Any change to the CompoundTransform object that affects
+		 * the various transforms should call this function. 
+		 * @param reason - the code indicating what changes to cause the invalidation.
+		 * @param affects3D - a flag indicating whether the change affects the 2D/3D nature of the various transforms.
+		 * @param dispatchChangeEvent - if true, the CompoundTransform will dispatch a change indicating that its underlying transforms
+		 * have been modified. 
+		 */
+		private function invalidate(reason:uint, affects3D:Boolean):void
+		{
+			//race("invalidating: " + reason);
+			switch(reason)
+			{
+				case INVALIDATE_FROM_PROPERTY:
+					sourceOfTruth = SOURCE_PROPERTIES;
+					_flags |= PROPERTIES_VALID;
+					_flags &= ~MATRIX_VALID;
+					_flags &= ~MATRIX3D_VALID;
+					break;
+				case INVALIDATE_FROM_MATRIX:
+					sourceOfTruth = SOURCE_MATRIX;
+					_flags |= MATRIX_VALID;
+					_flags &= ~PROPERTIES_VALID;
+					_flags &= ~MATRIX3D_VALID;
+					break;
+				case INVALIDATE_FROM_MATRIX3D:
+					sourceOfTruth = SOURCE_MATRIX3D;
+					_flags |= MATRIX3D_VALID;
+					_flags &= ~PROPERTIES_VALID;
+					_flags &= ~MATRIX_VALID;
+					break;
+			}                       
+			if (affects3D)
+				_flags &= ~M3D_FLAGS_VALID;
+			
+		}
+		
+		private static const EPSILON:Number = .001;
+		/**
+		 * @private
+		 * updates the flags that indicate whether the layout, offset, and/or computed transforms are 3D in nature.  
+		 * Since the user can set either the individual transform properties or the matrices directly, we compute these 
+		 * flags based on what the current 'source of truth' is for each of these values.
+		 */
+		private function update3DFlags():void
+		{           
+			if ((_flags & M3D_FLAGS_VALID) == 0)
+			{
+				var matrixIs3D:Boolean = false;
+				
+				switch(sourceOfTruth)
+				{
+					case SOURCE_PROPERTIES:
+						matrixIs3D = ( // note that rotationZ is the same as rotation, and not a 3D affecting                           
+							(Math.abs(_scaleZ-1) > EPSILON) ||  // property.
+							((Math.abs(_rotationX)+EPSILON)%360) > 2*EPSILON ||
+							((Math.abs(_rotationY)+EPSILON)%360) > 2*EPSILON ||
+							Math.abs(_z) > EPSILON
+						);
+						break;
+					case SOURCE_MATRIX:
+						matrixIs3D = false;
+						break;
+					case SOURCE_MATRIX3D:
+						var rawData:Vector.<Number> = _matrix3D.rawData;                    
+						matrixIs3D = (rawData[2] != 0 ||        // rotation y 
+							rawData[6] != 0 ||      // rotation x
+							rawData[8] !=0 ||       // rotation y
+							rawData[10] != 1 ||     // scalez / rotation x / rotation y
+							rawData[14] != 0);      // translation z
+						break;                              
+				}
+				
+				if (matrixIs3D)
+					_flags |= IS_3D;
+				else
+					_flags &= ~IS_3D;
+				
+				_flags |= M3D_FLAGS_VALID;
+			}
+		}
+		
+		
+		/** 
+		 *  Applies the delta to the transform's translation component. Unlike setting the x, y, or z properties directly,
+		 *  this method can be safely called without changing the transform's concept of 'the source of truth'.
+		 * 
+		 *  @param x The x value of the transform.
+		 *  
+		 *  @param y The y value of the transform.
+		 *  
+		 *  @param z The z value of the transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function translateBy(x:Number,y:Number,z:Number = 0):void
+		{
+			if (_flags & MATRIX_VALID)
+			{
+				_matrix.tx += x;
+				_matrix.ty += y;
+			}
+			if (_flags & PROPERTIES_VALID)
+			{
+				_x += x;
+				_y += y;
+				_z += z;
+			}
+			if (_flags & MATRIX3D_VALID)
+			{
+				var data:Vector.<Number> = _matrix3D.rawData;
+				data[12] += x;
+				data[13] += y;
+				data[14] += z;
+				_matrix3D.rawData = data;           
+			}   
+			invalidate(INVALIDATE_FROM_NONE, z != 0 /*affects3D*/);
+		}
+		
+		
+		/**
+		 *  The 2D matrix either set directly by the user, or composed by combining the transform center, scale, rotation
+		 *  and translation, in that order.  
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function get matrix():Matrix
+		{
+			
+			if (_flags & MATRIX_VALID)
+				return _matrix;
+			
+			if ((_flags & PROPERTIES_VALID) == false)
+				validatePropertiesFromMatrix();
+			
+			var m:Matrix = _matrix;
+			if (m == null)
+				m = _matrix = new Matrix();
+			else
+				m.identity();
+			
+			AdvancedLayoutFeatures.build2DMatrix(m,_transformX,_transformY,
+				_scaleX,_scaleY,
+				_rotationZ,
+				_x,_y);   
+			_flags |= MATRIX_VALID;
+			return m;       
+		}
+		
+		/**
+		 * @private
+		 */ 
+		public function set matrix(v:Matrix):void
+		{
+			if (_matrix== null)
+			{
+				_matrix = v.clone();
+			}
+			else
+			{
+				_matrix.identity(); 
+				_matrix.concat(v);          
+			}
+			
+			// affects3D is true since setting matrix changes the transform to 2D
+			invalidate(INVALIDATE_FROM_MATRIX, true /*affects3D*/);
+		}
+		
+		/**
+		 * @private
+		 * decomposes the offset transform matrices down into the convenience offset properties. Note that this is not
+		 * a bi-directional transformation -- it is possible to create a matrix that can't be fully represented in the
+		 * convenience properties. This function will pull from the matrix or matrix3D values, depending on which was most
+		 * recently set
+		 */
+		private function validatePropertiesFromMatrix():void
+		{       
+			if (sourceOfTruth == SOURCE_MATRIX3D)
+			{
+				var result:Vector.<Vector3D> = _matrix3D.decompose();
+				_rotationX = result[1].x / RADIANS_PER_DEGREES;
+				_rotationY = result[1].y / RADIANS_PER_DEGREES;
+				_rotationZ = result[1].z / RADIANS_PER_DEGREES;
+				_scaleX = result[2].x;
+				_scaleY = result[2].y;
+				_scaleZ = result[2].z;
+				
+				if (_transformX != 0 || _transformY != 0 || _transformZ != 0)
+				{
+					var postTransformTCenter:Vector3D = _matrix3D.transformVector(new Vector3D(_transformX,_transformY,_transformZ));
+					_x = postTransformTCenter.x - _transformX;
+					_y = postTransformTCenter.y - _transformY;
+					_z = postTransformTCenter.z - _transformZ;
+				}
+				else
+				{
+					_x = result[0].x;
+					_y = result[0].y;
+					_z = result[0].z;
+				}
+			}                        
+			else if (sourceOfTruth == SOURCE_MATRIX)
+			{
+				MatrixUtil.decomposeMatrix(decomposition,_matrix,_transformX,_transformY);
+				_x = decomposition[0];
+				_y = decomposition[1];
+				_z = 0;
+				_rotationX = 0;
+				_rotationY = 0;
+				_rotationZ = decomposition[2];
+				_scaleX = decomposition[3];
+				_scaleY = decomposition[4];
+				_scaleZ = 1;
+			}
+			_flags |= PROPERTIES_VALID;
+			
+		}
+		
+		
+		
+		/**
+		 *  The 3D matrix either set directly by the user, or composed by combining the transform center, scale, rotation
+		 *  and translation, in that order. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function get matrix3D():Matrix3D
+		{
+			if (_flags & MATRIX3D_VALID)
+				return _matrix3D;
+			
+			if ((_flags & PROPERTIES_VALID) == false)
+				validatePropertiesFromMatrix();
+			
+			var m:Matrix3D = _matrix3D;
+			if (m == null)
+				m =  _matrix3D = new Matrix3D();
+			else
+				m.identity();
+			
+			AdvancedLayoutFeatures.build3DMatrix(m,transformX,transformY,transformZ,
+				_scaleX,_scaleY,_scaleZ,
+				_rotationX,_rotationY,_rotationZ,                       
+				_x,_y,_z);
+			_flags |= MATRIX3D_VALID;
+			return m;
+			
+		}
+		
+		/**
+		 * @private
+		 */
+		public function set matrix3D(v:Matrix3D):void
+		{
+			if (_matrix3D == null)
+			{
+				_matrix3D = v.clone();
+			}
+			else
+			{
+				_matrix3D.identity();
+				if (v)
+					_matrix3D.append(v);            
+			}
+			invalidate(INVALIDATE_FROM_MATRIX3D, true /*affects3D*/);
+		}
+		
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/IAssetLayoutFeatures.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/IAssetLayoutFeatures.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/IAssetLayoutFeatures.as
new file mode 100644
index 0000000..1e36b60
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/IAssetLayoutFeatures.as
@@ -0,0 +1,371 @@
+/**
+ * Licensed 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.core.graphics.utils
+{
+	import flash.geom.Matrix;
+	import flash.geom.Matrix3D;
+	
+	
+	/**
+	 *  The IAssetLayoutFeatures interface defines the minimum properties and methods 
+	 *  required for an Object to support advanced transforms in embedded assets.
+	 *  
+	 *  @see mx.core.AdvancedLayoutFeatures
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4.1
+	 */
+	public interface IAssetLayoutFeatures
+	{
+		
+		/**
+		 *  Layout transform convenience property.  Represents the x value of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutX(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutX():Number;
+		
+		/**
+		 *  Layout transform convenience property.  Represents the y value of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutY(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutY():Number;
+		
+		/**
+		 *  Layout transform convenience property.  Represents the z value of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutZ(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutZ():Number;
+		
+		/**
+		 *  Used by the mirroring transform. See the mirror property.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get layoutWidth():Number;
+		
+		/**
+		 *  @private
+		 */
+		function set layoutWidth(value:Number):void;
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 *  The x value of the point around which any rotation and scale is performed in both the layout and computed matrix.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set transformX(value:Number):void;
+		/**
+		 * @private
+		 */
+		function get transformX():Number;
+		
+		/**
+		 *  The y value of the point around which any rotation and scale is performed in both the layout and computed matrix.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set transformY(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get transformY():Number;
+		
+		/**
+		 *  The z value of the point around which any rotation and scale is performed in both the layout and computed matrix.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set transformZ(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get transformZ():Number;
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 *  Layout transform convenience property.  Represents the rotation around the X axis of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutRotationX(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutRotationX():Number;
+		
+		/**
+		 *  Layout transform convenience property.  Represents the rotation around the Y axis of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutRotationY(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutRotationY():Number;
+		
+		/**
+		 *  Layout transform convenience property.  Represents the rotation around the Z axis of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutRotationZ(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutRotationZ():Number;
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 *  Layout transform convenience property.  Represents the scale along the X axis of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutScaleX(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutScaleX():Number;
+		
+		/**
+		 *  Layout transform convenience property.  Represents the scale along the Y axis of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutScaleY(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutScaleY():Number;
+		
+		/**
+		 *  Layout transform convenience property.  Represents the scale along the Z axis of the layout matrix used in layout and in 
+		 *  the computed transform.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutScaleZ(value:Number):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutScaleZ():Number;
+		
+		/**
+		 *  The 2D matrix used during layout calculations to determine the layout and size of the component and its parent and siblings.
+		 *  
+		 *   @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutMatrix(value:Matrix):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutMatrix():Matrix;
+		
+		/**
+		 *  The 3D matrix used during layout calculations to determine the layout and size of the component and its parent and siblings.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function set layoutMatrix3D(value:Matrix3D):void;
+		
+		/**
+		 * @private
+		 */
+		function get layoutMatrix3D():Matrix3D;
+		
+		/**
+		 *  True if the computed transform has 3D values.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get is3D():Boolean;
+		
+		/**
+		 *  True if the layout transform has 3D values.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get layoutIs3D():Boolean;
+		
+		/**
+		 *  If true the X axis is scaled by -1 and the x coordinate of the origin
+		 *  is translated by the component's width.  
+		 * 
+		 *  The net effect of this "mirror" transform is to flip the direction 
+		 *  that the X axis increases in without changing the layout element's 
+		 *  location relative to the parent's origin.
+		 * 
+		 *  @default false
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get mirror():Boolean;
+		
+		/**
+		 *  @private
+		 */
+		function set mirror(value:Boolean):void;
+		
+		
+		/**
+		 *  The stretchY is the horizontal component of the stretch scale factor which
+		 *  is applied before any other transformation property.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get stretchX():Number;
+		
+		/**
+		 *  @private
+		 */
+		function set stretchX(value:Number):void;
+		
+		/**
+		 *  The stretchY is the vertical component of the stretch scale factor which
+		 *  is applied before any other transformation property.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get stretchY():Number;
+		
+		/**
+		 *  @private
+		 */
+		function set stretchY(value:Number):void;
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 *  The computed matrix, calculated by combining the layout matrix and any offsets provided.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get computedMatrix():Matrix;
+		
+		/**
+		 *  The computed 3D matrix, calculated by combining the 3D layout matrix and any offsets provided.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.1
+		 */
+		function get computedMatrix3D():Matrix3D;
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/PathHelper.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/PathHelper.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/PathHelper.as
index 31bfd0e..5b5e136 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/PathHelper.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/PathHelper.as
@@ -15,18 +15,25 @@
 package org.apache.flex.core.graphics.utils
 {
 	import flash.display.GraphicsPath;
+	import flash.geom.Rectangle;
 
 	public class PathHelper
 	{
 		private static var segments:PathSegmentsCollection;
 		private static var graphicsPath:GraphicsPath = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
 		
-		public static function getSegments(data:String):GraphicsPath
+		public static function getSegments(data:String, x:Number=0, y:Number=0):GraphicsPath
 		{
 			segments = new PathSegmentsCollection(data);
-			segments.generateGraphicsPath(graphicsPath, 0, 0, 1, 1);
+			segments.generateGraphicsPath(graphicsPath, x, y, 1, 1);
 			return graphicsPath;	
 		}
+		
+		public static function getBounds(data:String):Rectangle
+		{
+			segments = new PathSegmentsCollection(data);
+			return segments.getBounds();
+		}
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/TransformOffsets.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/TransformOffsets.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/TransformOffsets.as
new file mode 100644
index 0000000..91389ba
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/utils/TransformOffsets.as
@@ -0,0 +1,367 @@
+/**
+ * Licensed 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.core.graphics.utils
+{
+	import flash.events.Event;
+	import flash.events.EventDispatcher;
+	
+	import __AS3__.vec.Vector;
+
+	
+	/**
+	 *  A CompoundTransform represents a 2D or 3D matrix transform. It can be used in the postLayoutTransformOffsets property on a UIComponent or GraphicElement.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public class TransformOffsets extends EventDispatcher 
+	{
+		//--------------------------------------------------------------------------
+		//
+		//  Constructor
+		//
+		//--------------------------------------------------------------------------
+		/**
+		 *  Constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function TransformOffsets()
+		{
+		}
+		
+		
+		
+		/**
+		 * @private
+		 * storage for transform properties. These values are concatenated together with the layout properties to
+		 * form the actual computed matrix used to render the object.
+		 */
+		private var _rotationX:Number = 0;
+		private var _rotationY:Number = 0;
+		private var _rotationZ:Number = 0;
+		private var _scaleX:Number = 1;
+		private var _scaleY:Number = 1;
+		private var _scaleZ:Number = 1;		
+		private var _x:Number = 0;
+		private var _y:Number = 0;
+		private var _z:Number = 0;
+		
+		/**
+		 * @private
+		 * flags for tracking whether the  transform is 3D. A transform is 3D if any of the 3D properties -- rotationX/Y, scaleZ, or z -- are set.
+		 */
+		private static const IS_3D:uint 				= 0x200;
+		private static const M3D_FLAGS_VALID:uint			= 0x400;
+		
+		/**
+		 * @private
+		 * general storage for all of our flags.  
+		 */
+		private var _flags:uint =  0;
+		
+		/**
+		 * @private
+		 */
+		public var owner:AdvancedLayoutFeatures;
+		//----------------------------------------------------------------------------
+		
+		/**
+		 * the  x value added to the transform
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set x(value:Number):void
+		{		
+			if (value == _x)
+				return;
+			_x = value;
+			invalidate(false);
+		}
+		/**
+		 * @private
+		 */
+		public function get x():Number
+		{		
+			return _x;
+		}
+		
+		/**
+		 * the y value added to the transform
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set y(value:Number):void
+		{		
+			if (value == _y)
+				return;
+			_y = value;
+			invalidate(false);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get y():Number
+		{		
+			return _y;
+		}
+		
+		/**
+		 * the z value added to the transform
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set z(value:Number):void
+		{		
+			if (value == _z)
+				return;
+			_z = value;
+			invalidate(true);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get z():Number
+		{		
+			return _z;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		
+		/**
+		 * the rotationX, in degrees, added to the transform
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set rotationX(value:Number):void
+		{		
+			if (value == _rotationX)
+				return;
+			_rotationX = value;
+			invalidate(true);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get rotationX():Number
+		{		
+			return _rotationX;
+		}
+		
+		/**
+		 * the rotationY, in degrees, added to the transform
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set rotationY(value:Number):void
+		{		
+			if (value == _rotationY)
+				return;
+			_rotationY = value;
+			invalidate(true);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get rotationY():Number
+		{		
+			return _rotationY;
+		}
+		
+		/**
+		 * the rotationZ, in degrees, added to the transform
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set rotationZ(value:Number):void
+		{		
+			if (value == _rotationZ)
+				return;
+			_rotationZ = value;
+			invalidate(false);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get rotationZ():Number
+		{		
+			return _rotationZ;
+		}
+		
+		//------------------------------------------------------------------------------
+		
+		
+		/**
+		 * the multiplier applied to the scaleX of the transform.  
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set scaleX(value:Number):void
+		{		
+			if (value == _scaleX)
+				return;
+			_scaleX = value;
+			invalidate(false);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get scaleX():Number
+		{
+			return _scaleX;
+		}
+		
+		/**
+		 * the multiplier applied to the scaleY of the transform.  
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set scaleY(value:Number):void
+		{		
+			if (value == _scaleY)
+				return;
+			_scaleY = value;
+			invalidate(false);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get scaleY():Number
+		{		
+			return _scaleY;
+		}
+		
+		
+		/**
+		 * the multiplier applied to the scaleZ of the transform.  
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function set scaleZ(value:Number):void
+		{		
+			if (value == _scaleZ)
+				return;
+			_scaleZ = value;
+			invalidate(true);
+		}
+		
+		/**
+		 * @private
+		 */
+		public function get scaleZ():Number
+		{		
+			return _scaleZ;
+		}
+		
+		
+		/**
+		 * @private
+		 * returns true if the transform has 3D values.
+		 */
+		public function get is3D():Boolean
+		{
+			if ((_flags & M3D_FLAGS_VALID) == 0)
+				update3DFlags();
+			return ((_flags & IS_3D) != 0);
+		}
+		
+		
+		//------------------------------------------------------------------------------
+		
+		/**
+		 * @private
+		 * invalidates our various cached values.  Any change to the CompoundTransform object that affects
+		 * the various transforms should call this function. 
+		 * @param reason - the code indicating what changes to cause the invalidation.
+		 * @param affects3D - a flag indicating whether the change affects the 2D/3D nature of the various transforms.
+		 * @param dispatchChangeEvent - if true, the CompoundTransform will dispatch a change indicating that its underlying transforms
+		 * have been modified. 
+		 */
+		private function invalidate(affects3D:Boolean,dispatchChangeEvent:Boolean = true):void
+		{
+			if (affects3D)
+				_flags &= ~M3D_FLAGS_VALID;
+			
+			if (dispatchChangeEvent)
+				dispatchEvent(new Event(Event.CHANGE));	
+		}
+		
+		private static const EPSILON:Number = .001;
+		/**
+		 * @private
+		 * updates the flags that indicate whether the layout, offset, and/or computed transforms are 3D in nature.  
+		 * Since the user can set either the individual transform properties or the matrices directly, we compute these 
+		 * flags based on what the current 'source of truth' is for each of these values.
+		 */
+		private function update3DFlags():void
+		{			
+			if ((_flags & M3D_FLAGS_VALID) == 0)
+			{
+				var matrixIs3D:Boolean = ( // note that rotationZ is the same as rotation, and not a 3D affecting							
+					(Math.abs(_scaleZ-1) > EPSILON) ||  // property.
+					((Math.abs(_rotationX)+EPSILON)%360) > 2*EPSILON ||
+					((Math.abs(_rotationY)+EPSILON)%360) > 2*EPSILON ||
+					Math.abs(_z) > EPSILON
+				);
+				if (matrixIs3D)
+					_flags |= IS_3D;
+				else
+					_flags &= ~IS_3D;				
+				_flags |= M3D_FLAGS_VALID;
+			}
+		}
+		
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientBase.js
new file mode 100644
index 0000000..46719ae
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientBase.js
@@ -0,0 +1,173 @@
+/**
+ * Licensed 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.
+ */
+
+/**
+ * org.apache.flex.core.graphics.GradientBase
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.graphics.GradientBase');
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.core.graphics.GradientBase = function() {
+};
+
+
+/**
+ * @protected
+ * @type {Array}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.colors = [];
+
+
+/**
+ * @protected
+ * @type {Array}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.ratios = [];
+
+
+/**
+ * @protected
+ * @type {Array}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.alphas = [];
+
+
+/**
+ * @private
+ * @type {Array}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype._entries = [];
+
+
+/**
+ * @private
+ * @type {number}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype._rotation = 0.0;
+
+
+/**
+ * @expose
+ * @return {Array}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.get_entries = function() {
+  return this._entries;
+};
+
+
+/**
+ * @expose
+ * @param {Array} value
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.set_entries = function(value) {
+  this._entries = value;
+};
+
+
+/**
+ * @expose
+ *  By default, the LinearGradientStroke defines a transition
+ *  from left to right across the control. 
+ *  Use the <code>rotation</code> property to control the transition direction. 
+ *  For example, a value of 180.0 causes the transition
+ *  to occur from right to left, rather than from left to right. 
+ * @return {number}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.get_rotation = function() {
+  return this._rotation;
+};
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.set_rotation = function(value) {
+  this._rotation = value;
+};
+
+
+/**
+ * @private
+ * @type {number}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype._x = 0;
+
+
+/**
+ * @expose
+ * @return {number}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.get_x = function() {
+  return this._x;
+};
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.set_x = function(value) {
+  this._x = value;
+};
+
+
+/**
+ * @private
+ * @type {number}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype._y = 0;
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.set_y = function(value) {
+  this._y = value;
+};
+
+
+/**
+ * @expose
+ * @return {number}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.get_y = function() {
+  return this._y;
+};
+
+
+/**
+ * @expose
+ * @return {string} A new gradient id value
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.get_newId = function(value) {
+  return String(Math.floor((Math.random() * 100000) + 1));
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.graphics.GradientBase.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'GradientBase', qName: 'org.apache.flex.core.graphics.GradientBase'}] };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientEntry.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientEntry.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientEntry.js
new file mode 100644
index 0000000..8fc7b58
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GradientEntry.js
@@ -0,0 +1,143 @@
+/**
+ * Licensed 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.
+ */
+
+/**
+ * org.apache.flex.core.graphics.GradientEntry
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.graphics.GradientEntry');
+
+
+/**
+ * @constructor
+ * @param {number} alpha
+ * @param {number} color
+ * @param {number} ratio
+ */
+org.apache.flex.core.graphics.GradientEntry = function(alpha, color, ratio) {
+  this._alpha = alpha;
+  this._color = color;
+  this._ratio = ratio;
+};
+
+
+/**
+ * @private
+ * @type {number}
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype._alpha = 1.0;
+
+
+/**
+ * @private
+ * @type {number}
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype._color = 0x000000;
+
+
+/**
+ * @private
+ * @type {number}
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype._ratio = 0x000000;
+
+
+/**
+ * @expose
+ * @return {number}
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.get_alpha = function() {
+  return this._alpha;
+};
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.set_alpha = function(value) {
+  var /** @type {number} */ oldValue = this._alpha;
+  if (value != oldValue) {
+    this._alpha = value;
+  }
+};
+
+
+/**
+ * @expose
+ * @return {number}
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.get_color = function() {
+  return this._color;
+};
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.set_color = function(value) {
+  var /** @type {number} */ oldValue = this._color;
+  if (value != oldValue) {
+    this._color = value;
+  }
+};
+
+
+/**
+ * @expose
+ * @return {number}
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.get_ratio = function() {
+  return this._ratio;
+};
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.set_ratio = function(value) {
+  this._ratio = value;
+};
+
+
+/**
+ * @expose
+ * @param {org.apache.flex.core.graphics.GraphicShape} s
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.begin = function(s) {
+  s.get_graphics().beginFill(this.get_color(), this.get_alpha());
+};
+
+
+/**
+ * @expose
+ * @param {org.apache.flex.core.graphics.GraphicShape} s
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.end = function(s) {
+  s.get_graphics().endFill();
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.graphics.GradientEntry.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'GradientEntry', qName: 'org.apache.flex.core.graphics.GradientEntry'}] };


[7/7] git commit: [flex-asjs] [refs/heads/develop] - Add support for LinearGradient for AS and JS versions. Includes support for gradient rotation as well. Elliptical Arc (A) property of Path does not support gradient rotations (yet) in the AS version

Posted by bi...@apache.org.
Add support for LinearGradient for AS and JS versions.
Includes support for gradient rotation as well.
Elliptical Arc (A) property of Path does not support gradient rotations (yet) in the AS version


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/9999c237
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/9999c237
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/9999c237

Branch: refs/heads/develop
Commit: 9999c237abe8406fa55c1e7ddfa8b61d8eeb057e
Parents: 6929517
Author: Om <bi...@gmail.com>
Authored: Tue Sep 16 18:23:30 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Tue Sep 16 18:24:47 2014 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/core/graphics/Circle.as |   17 +-
 .../org/apache/flex/core/graphics/Ellipse.as    |    3 +-
 .../apache/flex/core/graphics/GradientBase.as   |   56 +
 .../apache/flex/core/graphics/GraphicShape.as   |    5 +-
 .../flex/core/graphics/GraphicsContainer.as     |   10 +-
 .../src/org/apache/flex/core/graphics/IFill.as  |    3 +-
 .../apache/flex/core/graphics/LinearGradient.as |    6 +-
 .../src/org/apache/flex/core/graphics/Path.as   | 1704 +-----------------
 .../src/org/apache/flex/core/graphics/Rect.as   |   17 +-
 .../org/apache/flex/core/graphics/SolidColor.as |    3 +-
 .../graphics/utils/AdvancedLayoutFeatures.as    | 1140 ++++++++++++
 .../core/graphics/utils/CompoundTransform.as    |  777 ++++++++
 .../core/graphics/utils/IAssetLayoutFeatures.as |  371 ++++
 .../flex/core/graphics/utils/PathHelper.as      |   11 +-
 .../core/graphics/utils/TransformOffsets.as     |  367 ++++
 .../apache/flex/core/graphics/GradientBase.js   |  173 ++
 .../apache/flex/core/graphics/GradientEntry.js  |  143 ++
 .../apache/flex/core/graphics/GraphicShape.js   |   16 +-
 .../apache/flex/core/graphics/LinearGradient.js |  124 ++
 .../org/apache/flex/core/graphics/SolidColor.js |    2 +-
 20 files changed, 3241 insertions(+), 1707 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
index d49a8a6..fdbb336 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Circle.as
@@ -1,5 +1,20 @@
+/**
+ * Licensed 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.core.graphics
 {
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 
 	public class Circle extends GraphicShape
@@ -20,7 +35,7 @@ package org.apache.flex.core.graphics
 		{
 			graphics.clear();
 			applyStroke();
-			beginFill(new Rectangle(x, y, radius*2, radius*2));
+			beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
 			graphics.drawCircle(x,y,radius);
 			endFill();
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
index db1a6ae..32dc73a 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
@@ -2,6 +2,7 @@ package org.apache.flex.core.graphics
 {
 	import flash.display.CapsStyle;
 	import flash.display.JointStyle;
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 
 	public class Ellipse extends GraphicShape
@@ -23,7 +24,7 @@ package org.apache.flex.core.graphics
 		{
 			graphics.clear();
 			applyStroke();
-			beginFill(new Rectangle(x, y, width, height));
+			beginFill(new Rectangle(x, y, width, height), new Point(x,y));
 			graphics.drawEllipse(x,y,width,height);
 			endFill();
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as
index 82c740b..69d6ab8 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GradientBase.as
@@ -14,6 +14,7 @@
 
 package org.apache.flex.core.graphics
 {
+	import org.apache.flex.core.graphics.utils.CompoundTransform;
 
 	public class GradientBase
 	{
@@ -24,6 +25,55 @@ package org.apache.flex.core.graphics
 		
 		protected var alphas:Array /* of Number */ = [];
 		
+		/**
+		 *  Holds the matrix and the convenience transform properties (<code>x</code>, <code>y</code>, and <code>rotation</code>).
+		 *  The compoundTransform is only created when the <code>matrix</code> property is set. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 */
+		protected var compoundTransform:CompoundTransform;
+		
+		/**
+		 *  Value of the width and height of the untransformed gradient
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 */ 
+		public static const GRADIENT_DIMENSION:Number = 1638.4;
+		
+		/**
+		 *  Storage for the angle property.
+		 */
+		private var _angle:Number;
+		
+		/**
+		 *  By default, the LinearGradientStroke defines a transition
+		 *  from left to right across the control. 
+		 *  Use the <code>angle</code> property to control the transition direction. 
+		 *  For example, a value of 180.0 causes the transition
+		 *  to occur from right to left, rather than from left to right.
+		 *
+		 *  @default 0.0
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 */
+		public function get angle():Number
+		{
+			return _angle / Math.PI * 180;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set angle(value:Number):void
+		{
+			_angle = value / 180 * Math.PI;
+		}  
 
 		/**
 		 *  Storage for the entries property.
@@ -124,6 +174,12 @@ package org.apache.flex.core.graphics
 			return a*Math.PI/180;
 		}
 		
+		
+		protected function get rotationInRadians():Number
+		{
+			return rotation / 180 * Math.PI;
+		}
+		
 		/**
 		 *  @private
 		 *  Extract the gradient information in the public <code>entries</code>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
index 65c4f32..b5decbc 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicShape.as
@@ -15,6 +15,7 @@
 package org.apache.flex.core.graphics
 {
 	
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 	
 	import org.apache.flex.core.UIBase;
@@ -67,11 +68,11 @@ package org.apache.flex.core.graphics
 			}
 		}
 		
-		protected function beginFill(targetBounds:Rectangle):void
+		protected function beginFill(targetBounds:Rectangle,targetOrigin:Point):void
 		{
 			if(fill)
 			{
-				fill.begin(this, targetBounds);
+				fill.begin(this, targetBounds,targetOrigin);
 			}
 		}
 		

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
index c99b3a7..7277b85 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
@@ -15,6 +15,7 @@
 package org.apache.flex.core.graphics
 {
 	import flash.display.GraphicsPath;
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 	
 	import org.apache.flex.core.graphics.utils.PathHelper;
@@ -44,7 +45,7 @@ package org.apache.flex.core.graphics
 		public function drawRect(x:Number, y:Number, width:Number, height:Number):void
 		{
 			applyStroke();
-			beginFill(new Rectangle(x, y, width, height));
+			beginFill(new Rectangle(x, y, width, height), new Point(x,y) );
 			graphics.drawRect(x, y, width, height);
 			endFill();
 		}
@@ -64,7 +65,7 @@ package org.apache.flex.core.graphics
 		public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
 		{
 			applyStroke();
-			beginFill(new Rectangle(x,y,width,height));
+			beginFill(new Rectangle(x,y,width,height), new Point(x,y));
 			graphics.drawEllipse(x,y,width,height);
 			endFill();
 		}
@@ -83,7 +84,7 @@ package org.apache.flex.core.graphics
 		public function drawCircle(x:Number, y:Number, radius:Number):void
 		{
 			applyStroke();
-			beginFill(new Rectangle(x,y,radius*2, radius*2));
+			beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
 			graphics.drawCircle(x,y,radius);
 			endFill();
 		}
@@ -106,7 +107,8 @@ package org.apache.flex.core.graphics
 		public function drawPath(data:String):void
 		{
 			applyStroke();
-			beginFill(new Rectangle());
+			var bounds:Rectangle = PathHelper.getBounds(data);
+			beginFill(bounds,bounds.topLeft);
 			var graphicsPath:GraphicsPath = PathHelper.getSegments(data);
 			graphics.drawPath(graphicsPath.commands, graphicsPath.data);
 			endFill();

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
index 6ecbb8a..8e025d2 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/IFill.as
@@ -14,11 +14,12 @@
 
 package org.apache.flex.core.graphics
 {
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 
 	public interface IFill
 	{
-		function begin(s:GraphicShape,targetBounds:Rectangle):void;
+		function begin(s:GraphicShape,targetBounds:Rectangle, targetOrigin:Point):void;
 		function end(s:GraphicShape):void;
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as
index 87d1fb0..6eee7c3 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/LinearGradient.as
@@ -18,6 +18,7 @@ package org.apache.flex.core.graphics
 	import flash.display.InterpolationMethod;
 	import flash.display.SpreadMethod;
 	import flash.geom.Matrix;
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 	
 	public class LinearGradient extends GradientBase implements IFill
@@ -39,13 +40,14 @@ package org.apache.flex.core.graphics
 			_scaleX = value;
 		}
 		
-		public function begin(s:GraphicShape,targetBounds:Rectangle):void
+		public function begin(s:GraphicShape,targetBounds:Rectangle, targetOrigin:Point):void
 		{
 			commonMatrix.identity();
-			commonMatrix.createGradientBox(targetBounds.width,targetBounds.height,toRad(this.rotation));
+			commonMatrix.createGradientBox(targetBounds.width,targetBounds.height,toRad(this.rotation),targetOrigin.x, targetOrigin.y);
 			
 			s.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios,
 				commonMatrix, SpreadMethod.PAD, InterpolationMethod.RGB);
+			
 		}
 		
 		public function end(s:GraphicShape):void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
index ec14340..7d1eb53 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Path.as
@@ -1,16 +1,28 @@
+/**
+ * Licensed 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.core.graphics
 {
-	import flash.display.CapsStyle;
 	import flash.display.GraphicsPath;
-	import flash.display.JointStyle;
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
+	
+	import org.apache.flex.core.graphics.utils.PathHelper;
 
 	public class Path extends GraphicShape
 	{
 		
-		private var segments:PathSegmentsCollection;
-		private var graphicsPath:GraphicsPath = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
-		
 		/**
 		 *  Draw the path.
 		 *  @param data A string containing a compact represention of the path segments.
@@ -28,1689 +40,15 @@ package org.apache.flex.core.graphics
 		 */
 		public function drawPath(x:Number,y:Number,data:String):void
 		{
+			
 			graphics.clear();
 			applyStroke();
-			beginFill(new Rectangle());
-			segments = new PathSegmentsCollection(data);
-			if (segments)
-				segments.generateGraphicsPath(graphicsPath, x, y, 1, 1);
-			
+			var bounds:Rectangle = PathHelper.getBounds(data);
+			beginFill(bounds,new Point(bounds.left + x, bounds.top + y) );
+			var graphicsPath:GraphicsPath = PathHelper.getSegments(data,x,y);
 			graphics.drawPath(graphicsPath.commands, graphicsPath.data);
 			endFill();
-		}
-	}
-}
-
-
-//--------------------------------------------------------------------------
-//
-//  Internal Helper Class - PathSegmentsCollection
-//
-//--------------------------------------------------------------------------
-
-/**
- *  Helper class that takes in a string and stores and generates a vector of
- *  Path segments.
- *  Provides methods for generating GraphicsPath and calculating bounds. 
- */
-class PathSegmentsCollection
-{
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Constructor.
-	 * 
-	 *  @param value 
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function PathSegmentsCollection(value:String)
-	{
-		if (!value)
-		{
-			_segments = new Vector.<PathSegment>();
-			return;
-		}
-		
-		var newSegments:Vector.<PathSegment> = new Vector.<PathSegment>();
-		var charCount:int = value.length;
-		var c:Number; // current char code, String.charCodeAt() returns Number.
-		var useRelative:Boolean;
-		var prevIdentifier:Number = 0;
-		var prevX:Number = 0;
-		var prevY:Number = 0;
-		var lastMoveX:Number = 0;
-		var lastMoveY:Number = 0;
-		var x:Number;
-		var y:Number;
-		var controlX:Number;
-		var controlY:Number;
-		var control2X:Number;
-		var control2Y:Number;
-		var lastMoveSegmentIndex:int = -1;
-		
-		_dataLength = charCount;
-		_charPos = 0;
-		while (true)
-		{
-			// Skip any whitespace or commas first
-			skipWhiteSpace(value);
-			
-			// Are we done parsing?
-			if (_charPos >= charCount)
-				break;
-			
-			// Get the next character
-			c = value.charCodeAt(_charPos++);
-			
-			// Is this a start of a number? 
-			// The RegExp for a float is /[+-]?\d*\.?\d+([Ee][+-]?\d+)?/
-			if ((c >= 0x30 && c < 0x3A) ||   // A digit
-				(c == 0x2B || c == 0x2D) ||  // '+' & '-'
-				(c == 0x2E))                 // '.'
-			{
-				c = prevIdentifier;
-				_charPos--;
-			}
-			else if (c >= 0x41 && c <= 0x56) // Between 'A' and 'V' 
-				useRelative = false;
-			else if (c >= 0x61 && c <= 0x7A) // Between 'a' and 'v'
-				useRelative = true;
-			
-			switch(c)
-			{
-				case 0x63:  // c
-				case 0x43:  // C
-					controlX = getNumber(useRelative, prevX, value);
-					controlY = getNumber(useRelative,  prevY, value);
-					control2X = getNumber(useRelative, prevX, value);
-					control2Y = getNumber(useRelative, prevY, value);
-					x = getNumber(useRelative, prevX, value);
-					y = getNumber(useRelative, prevY, value);
-					newSegments.push(new CubicBezierSegment(controlX, controlY, 
-						control2X, control2Y,
-						x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x63;
-					
-					break;
-				
-				case 0x6D:  // m
-				case 0x4D:  // M
-					x = getNumber(useRelative, prevX, value);
-					y = getNumber(useRelative, prevY, value);
-					newSegments.push(new MoveSegment(x, y));
-					prevX = x;
-					prevY = y;
-					// If a moveto is followed by multiple pairs of coordinates, 
-					// the subsequent pairs are treated as implicit lineto commands.
-					prevIdentifier = (c == 0x6D) ? 0x6C : 0x4C; // c == 'm' ? 'l' : 'L'
-					
-					// Fix for bug SDK-24457:
-					// If the Quadratic segment is isolated, the Player
-					// won't draw fill correctly. We need to generate
-					// a dummy line segment.
-					var curSegmentIndex:int = newSegments.length - 1;
-					if (lastMoveSegmentIndex + 2 == curSegmentIndex && 
-						newSegments[lastMoveSegmentIndex + 1] is QuadraticBezierSegment)
-					{
-						// Insert a dummy LineSegment
-						newSegments.splice(lastMoveSegmentIndex + 1, 0, new LineSegment(lastMoveX, lastMoveY));
-						curSegmentIndex++;
-					}
-					
-					lastMoveSegmentIndex = curSegmentIndex;
-					lastMoveX = x;
-					lastMoveY = y;
-					break;
-				
-				case 0x6C:  // l
-				case 0x4C:  // L
-					x = getNumber(useRelative, prevX, value);
-					y = getNumber(useRelative, prevY, value);
-					newSegments.push(new LineSegment(x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x6C;
-					break;
-				
-				case 0x68:  // h
-				case 0x48:  // H
-					x = getNumber(useRelative, prevX, value);
-					y = prevY;
-					newSegments.push(new LineSegment(x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x68;
-					break;
-				
-				case 0x76:  // v
-				case 0x56:  // V
-					x = prevX;
-					y = getNumber(useRelative, prevY, value);
-					newSegments.push(new LineSegment(x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x76;
-					break;
-				
-				case 0x71:  // q
-				case 0x51:  // Q
-					controlX = getNumber(useRelative, prevX, value);
-					controlY = getNumber(useRelative, prevY, value);
-					x = getNumber(useRelative, prevX, value);
-					y = getNumber(useRelative, prevY, value);
-					newSegments.push(new QuadraticBezierSegment(controlX, controlY, x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x71;
-					break;
-				
-				case 0x74:  // t
-				case 0x54:  // T
-					// control is a reflection of the previous control point
-					if (prevIdentifier == 0x74 || prevIdentifier == 0x71) // 't' or 'q'
-					{
-						controlX = prevX + (prevX - controlX);
-						controlY = prevY + (prevY - controlY);
-					}
-					else
-					{
-						controlX = prevX;
-						controlY = prevY;
-					}
-					
-					x = getNumber(useRelative, prevX, value);
-					y = getNumber(useRelative, prevY, value);
-					newSegments.push(new QuadraticBezierSegment(controlX, controlY, x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x74;
-					
-					break;
-				
-				case 0x73:  // s
-				case 0x53:  // S
-					if (prevIdentifier == 0x73 || prevIdentifier == 0x63) // s or c
-					{
-						controlX = prevX + (prevX - control2X);
-						controlY = prevY + (prevY - control2Y);
-					}
-					else
-					{
-						controlX = prevX;
-						controlY = prevY;
-					}
-					
-					control2X = getNumber(useRelative, prevX, value);
-					control2Y = getNumber(useRelative, prevY, value);
-					x = getNumber(useRelative, prevX, value);
-					y = getNumber(useRelative, prevY, value);
-					newSegments.push(new CubicBezierSegment(controlX, controlY,
-						control2X, control2Y, x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x73;
-					
-					break;
-				case 0x61:	//a
-				case 0x41:	//A
-					var rx:Number = getNumber(useRelative, prevX, value);
-					var ry:Number = getNumber(useRelative, prevY, value);
-					var angle:Number = getNumber(useRelative, prevY, value);
-					var largeArcFlag:Boolean = getNumber(useRelative, prevY, value) == 1 ? true:false;
-					var sweepFlag:Boolean = getNumber(useRelative, prevY, value) == 1 ? true:false;
-					var endX:Number = getNumber(useRelative, prevX, value);
-					var endY:Number = getNumber(useRelative, prevY, value);
-					newSegments.push(new EllipticalArcSegment(rx,ry,angle,largeArcFlag,sweepFlag,endX,endY));
-					prevX = endX;
-					prevY = endY;
-					prevIdentifier = 0x41;
-					break;
-				case 0x7A:  // z
-				case 0x5A:  // Z
-					x = lastMoveX;
-					y = lastMoveY;
-					newSegments.push(new LineSegment(x, y));
-					prevX = x;
-					prevY = y;
-					prevIdentifier = 0x7A;
-					
-					break;
-				
-				default:
-					// unknown identifier, throw error?
-					_segments = new Vector.<PathSegment>();
-					return;
-			}
-		}
-		
-		// Fix for bug SDK-24457:
-		// If the Quadratic segment is isolated, the Player
-		// won't draw fill correctly. We need to generate
-		// a dummy line segment.
-		curSegmentIndex = newSegments.length;
-		if (lastMoveSegmentIndex + 2 == curSegmentIndex && 
-			newSegments[lastMoveSegmentIndex + 1] is QuadraticBezierSegment)
-		{
-			// Insert a dummy LineSegment
-			newSegments.splice(lastMoveSegmentIndex + 1, 0, new LineSegment(lastMoveX, lastMoveY));
-			curSegmentIndex++;
-		}
-		
-		_segments = newSegments;
-	}
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Properties
-	//
-	//--------------------------------------------------------------------------
-	
-	//----------------------------------
-	//  data
-	//----------------------------------
-	
-	private var _segments:Vector.<PathSegment>;
-	
-	/**
-	 *  A Vector of the actual path segments. May be empty, but always non-null. 
-	 */
-	public function get data():Vector.<PathSegment>
-	{
-		return _segments;
-	}
-	
-	//----------------------------------
-	//  bounds
-	//----------------------------------
-	
-	private var _bounds:Rectangle;
-	
-	/**
-	 *  The bounds of the segments in local coordinates.  
-	 */
-	public function getBounds():Rectangle
-	{
-		if (_bounds)
-			return _bounds;
-		
-		// First, allocate temporary bounds, as getBoundingBox() requires
-		// natual bounds to calculate a scaling factor
-		_bounds = new Rectangle(0, 0, 1, 1);
-		
-		// Pass in the same size to getBoundingBox
-		// so that the scaling factor is (1, 1).
-		_bounds = getBoundingBox(1, 1, null /*Matrix*/);
-		return _bounds;
-	}
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  @return Returns the axis aligned bounding box of the segments stretched to 
-	 *  width, height and then transformed with transformation matrix m.
-	 */
-	public function getBoundingBox(width:Number, height:Number, m:Matrix):Rectangle
-	{
-		var naturalBounds:Rectangle = getBounds();
-		var sx:Number = naturalBounds.width == 0 ? 1 : width / naturalBounds.width;
-		var sy:Number = naturalBounds.height == 0 ? 1 : height / naturalBounds.height; 
-		
-		var prevSegment:PathSegment;
-		var pathBBox:Rectangle;
-		var count:int = _segments.length;
-		
-		for (var i:int = 0; i < count; i++)
-		{
-			var segment:PathSegment = _segments[i];
-			pathBBox = segment.getBoundingBox(prevSegment, sx, sy, m, pathBBox);
-			prevSegment = segment;
-		}
-		
-		// If path is empty, it's untransformed bounding box is (0,0), so we return transformed point (0,0)
-		if (!pathBBox)
-		{
-			var x:Number = m ? m.tx : 0;
-			var y:Number = m ? m.ty : 0;
-			pathBBox = new Rectangle(x, y);
-		}
-		return pathBBox;
-	}
-	
-	/**
-	 *  Workhorse method that iterates through the <code>segments</code>
-	 *  array and draws each path egment based on its control points. 
-	 *  
-	 *  Segments are drawn from the x and y position of the path. 
-	 *  Additionally, segments are drawn by taking into account the scale  
-	 *  applied to the path. 
-	 * 
-	 *  @param tx A Number representing the x position of where this 
-	 *  path segment should be drawn
-	 *  
-	 *  @param ty A Number representing the y position of where this  
-	 *  path segment should be drawn
-	 * 
-	 *  @param sx A Number representing the scaleX at which to draw 
-	 *  this path segment 
-	 * 
-	 *  @param sy A Number representing the scaleY at which to draw this
-	 *  path segment
-	 */
-	public function generateGraphicsPath(graphicsPath:GraphicsPath,
-										 tx:Number, 
-										 ty:Number, 
-										 sx:Number, 
-										 sy:Number):void
-	{
-		graphicsPath.commands = null;
-		graphicsPath.data = null;
-		
-		// Always start by moving to drawX, drawY. Otherwise
-		// the path will begin at the previous pen location
-		// if it does not start with a MoveSegment.
-		graphicsPath.moveTo(tx, ty);
-		
-		var curSegment:PathSegment;
-		var prevSegment:PathSegment;
-		var count:int = _segments.length;
-		for (var i:int = 0; i < count; i++)
-		{
-			prevSegment = curSegment;
-			curSegment = _segments[i];
-			curSegment.draw(graphicsPath, tx, ty, sx, sy, prevSegment);
-		}
-	}
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Private methods
-	//
-	//--------------------------------------------------------------------------
-	
-	private var _charPos:int = 0;
-	private var _dataLength:int = 0;
-	
-	private function skipWhiteSpace(data:String):void
-	{
-		while (_charPos < _dataLength)
-		{
-			var c:Number = data.charCodeAt(_charPos);
-			if (c != 0x20 && // Space
-				c != 0x2C && // Comma
-				c != 0xD  && // Carriage return
-				c != 0x9  && // Tab
-				c != 0xA)    // New line
-			{
-				break;
-			}
-			_charPos++;
-		}
-	}
-	
-	private function getNumber(useRelative:Boolean, offset:Number, value:String):Number
-	{
-		// Parse the string and find the first occurrance of the following RexExp
-		// numberRegExp:RegExp = /[+-]?\d*\.?\d+([Ee][+-]?\d+)?/g;
-		
-		skipWhiteSpace(value); // updates _charPos
-		if (_charPos >= _dataLength)
-			return NaN;
-		
-		// Remember the start of the number
-		var numberStart:int = _charPos;
-		var hasSignCharacter:Boolean = false;
-		var hasDigits:Boolean = false;
-		
-		// The number could start with '+' or '-' (the "[+-]?" part of the RegExp)
-		var c:Number = value.charCodeAt(_charPos);
-		if (c == 0x2B || c == 0x2D) // '+' or '-'
-		{
-			hasSignCharacter = true;
-			_charPos++;
-		}
-		
-		// The index of the '.' if any
-		var dotIndex:int = -1;
-		
-		// First sequence of digits and optional dot in between (the "\d*\.?\d+" part of the RegExp)
-		while (_charPos < _dataLength)
-		{
-			c = value.charCodeAt(_charPos);
-			
-			if (c >= 0x30 && c < 0x3A) // A digit
-			{
-				hasDigits = true;
-			}
-			else if (c == 0x2E && dotIndex == -1) // '.'
-			{
-				dotIndex = _charPos;
-			}
-			else
-				break;
-			
-			_charPos++;
-		}
-		
-		// Now check whether we had at least one digit.
-		if (!hasDigits)
-		{
-			// Go to the end of the data
-			_charPos = _dataLength;
-			return NaN;
-		}
-		
-		// 1. Was the last character a '.'? If so, rewind one character back.
-		if (c == 0x2E)
-			_charPos--;
-		
-		// So far we have a valid number, remember its end character index
-		var numberEnd:int = _charPos;
-		
-		// Check to see if we have scientific notation (the "([Ee][+-]?\d+)?" part of the RegExp)
-		if (c == 0x45 || c == 0x65)
-		{
-			_charPos++;
-			
-			// Check for '+' or '-'
-			if (_charPos < _dataLength)
-			{            
-				c = value.charCodeAt(_charPos);
-				if (c == 0x2B || c == 0x2D)
-					_charPos++;
-			}
-			
-			// Find all the digits
-			var digitStart:int = _charPos;
-			while (_charPos < _dataLength)
-			{
-				c = value.charCodeAt(_charPos);
-				
-				// Not a digit?
-				if (!(c >= 0x30 && c < 0x3A))
-				{
-					break;
-				}
-				
-				_charPos++;
-			}
-			
-			// Do we have at least one digit?
-			if (digitStart < _charPos)
-				numberEnd = _charPos; // Scientific notation, update the end index of the number.
-			else
-				_charPos = numberEnd; // No scientific notation, rewind back to the end index of the number.
-		}
-		
-		// Use parseFloat to get the actual number.
-		// TODO (egeorgie): we could build the number while matching the RegExp which will save the substr and parseFloat
-		var subString:String = value.substr(numberStart, numberEnd - numberStart);
-		var result:Number = parseFloat(subString);
-		if (isNaN(result))
-		{
-			// Go to the end of the data
-			_charPos = _dataLength;
-			return NaN;
-		}
-		_charPos = numberEnd;
-		return useRelative ? result + offset : result;
-	}
-}
-
-//--------------------------------------------------------------------------
-//
-//  Internal Helper Class - PathSegment 
-//
-//--------------------------------------------------------------------------
-import flash.display.GraphicsPath;
-import flash.geom.Matrix;
-import flash.geom.Rectangle;
-
-
-/**
- *  The PathSegment class is the base class for a segment of a path.
- *  This class is not created directly. It is the base class for 
- *  MoveSegment, LineSegment, CubicBezierSegment and QuadraticBezierSegment.
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-class PathSegment extends Object
-{
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Constructor.
-	 * 
-	 *  @param _x The x position of the pen in the current coordinate system.
-	 *  
-	 *  @param _y The y position of the pen in the current coordinate system.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function PathSegment(_x:Number = 0, _y:Number = 0)
-	{
-		super();
-		x = _x;  
-		y = _y; 
-	}   
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Properties
-	//
-	//--------------------------------------------------------------------------
-	
-	//----------------------------------
-	//  x
-	//----------------------------------
-	
-	/**
-	 *  The ending x position for this segment.
-	 *
-	 *  @default 0
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var x:Number = 0;
-	
-	//----------------------------------
-	//  y
-	//----------------------------------
-	
-	/**
-	 *  The ending y position for this segment.
-	 *
-	 *  @default 0
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var y:Number = 0;
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Draws this path segment. You can determine the current pen position by 
-	 *  reading the x and y values of the previous segment. 
-	 *
-	 *  @param g The graphics context to draw into.
-	 *  @param prev The previous segment drawn, or null if this is the first segment.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
-	{
-		// Override to draw your segment
-	}
-	
-	/**
-	 *  @param prev The previous segment drawn, or null if this is the first segment.
-	 *  @param sx Pre-transform scale factor for x coordinates.
-	 *  @param sy Pre-transform scale factor for y coordinates.
-	 *  @param m Transformation matrix.
-	 *  @param rect If non-null, rect is expanded to include the bounding box of the segment.
-	 *  @return Returns the union of rect and the axis aligned bounding box of the post-transformed
-	 *  path segment.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */    
-	public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number, m:Matrix, rect:Rectangle):Rectangle
-	{
-		// Override to calculate your segment's bounding box.
-		return rect;
-	}
-	
-	/**
-	 *  Returns the tangent for the segment. 
-	 *  @param prev The previous segment drawn, or null if this is the first segment.
-	 *  @param start If true, returns the tangent to the start point, otherwise the tangend to the end point.
-	 *  @param sx Pre-transform scale factor for x coordinates.
-	 *  @param sy Pre-transform scale factor for y coordinates.
-	 *  @param m Transformation matrix.
-	 *  @param result The tangent is returned as vector (x, y) in result.
-	 */
-	public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
-	{
-		result.x = 0;
-		result.y = 0;
-	}
-}
-
-
-//--------------------------------------------------------------------------
-//
-//  Internal Helper Class - LineSegment 
-//
-//--------------------------------------------------------------------------
-
-import flash.display.GraphicsPath;
-import flash.geom.Matrix;
-import flash.geom.Point;
-import flash.geom.Rectangle;
-
-
-/**
- *  The LineSegment draws a line from the current pen position to the coordinate located at x, y.
- *  
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-class LineSegment extends PathSegment
-{
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Constructor.
-	 *  
-	 *  @param x The current location of the pen along the x axis. The <code>draw()</code> method uses 
-	 *  this value to determine where to draw to.
-	 * 
-	 *  @param y The current location of the pen along the y axis. The <code>draw()</code> method uses 
-	 *  this value to determine where to draw to.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function LineSegment(x:Number = 0, y:Number = 0)
-	{
-		super(x, y);
-	}   
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  @inheritDoc
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
-	{
-		graphicsPath.lineTo(dx + x*sx, dy + y*sy);
-	}
-	
-	/**
-	 *  @inheritDoc
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number, m:Matrix, rect:Rectangle):Rectangle
-	{
-		pt = MatrixUtil.transformPoint(x * sx, y * sy, m);
-		var x1:Number = pt.x;
-		var y1:Number = pt.y;
-		
-		// If the previous segment actually draws, then only add the end point to the rectangle,
-		// as the start point would have been added by the previous segment:
-		if (prev != null && !(prev is MoveSegment))
-			return MatrixUtil.rectUnion(x1, y1, x1, y1, rect); 
-		
-		var pt:Point = MatrixUtil.transformPoint(prev ? prev.x * sx : 0, prev ? prev.y * sy : 0, m);
-		var x2:Number = pt.x;
-		var y2:Number = pt.y;
-		
-		return MatrixUtil.rectUnion(Math.min(x1, x2), Math.min(y1, y2),
-			Math.max(x1, x2), Math.max(y1, y2), rect); 
-	}
-	
-	/**
-	 *  Returns the tangent for the segment. 
-	 *  @param prev The previous segment drawn, or null if this is the first segment.
-	 *  @param start If true, returns the tangent to the start point, otherwise the tangend to the end point.
-	 *  @param sx Pre-transform scale factor for x coordinates.
-	 *  @param sy Pre-transform scale factor for y coordinates.
-	 *  @param m Transformation matrix.
-	 *  @param result The tangent is returned as vector (x, y) in result.
-	 */
-	override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
-	{
-		var pt0:Point = MatrixUtil.transformPoint(prev ? prev.x * sx : 0, prev ? prev.y * sy : 0, m).clone();
-		var pt1:Point = MatrixUtil.transformPoint(x * sx, y * sy, m);
-		
-		result.x = pt1.x - pt0.x;
-		result.y = pt1.y - pt0.y;
-	}
-}
-
-//--------------------------------------------------------------------------
-//
-//  Internal Helper Class - MoveSegment 
-//
-//--------------------------------------------------------------------------
-import flash.display.GraphicsPath;
-
-/**
- *  The MoveSegment moves the pen to the x,y position. This class calls the <code>Graphics.moveTo()</code> method 
- *  from the <code>draw()</code> method.
- * 
- *  
- *  @see flash.display.Graphics
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-class MoveSegment extends PathSegment
-{
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Constructor.
-	 *  
-	 *  @param x The target x-axis location in 2-d coordinate space.
-	 *  
-	 *  @param y The target y-axis location in 2-d coordinate space.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function MoveSegment(x:Number = 0, y:Number = 0)
-	{
-		super(x, y);
-	}   
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  @inheritDoc
-	 * 
-	 *  The MoveSegment class moves the pen to the position specified by the
-	 *  x and y properties.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
-	{
-		graphicsPath.moveTo(dx+x*sx, dy+y*sy);
-	}
-}
-
-//--------------------------------------------------------------------------
-//
-//  Internal Helper Class - CubicBezierSegment 
-//
-//--------------------------------------------------------------------------
-
-import flash.display.GraphicsPath;
-import flash.geom.Matrix;
-import flash.geom.Point;
-import flash.geom.Rectangle;
-
-import org.apache.flex.core.graphics.utils.MatrixUtil;
-
-/**
- *  The CubicBezierSegment draws a cubic bezier curve from the current pen position 
- *  to x, y. The control1X and control1Y properties specify the first control point; 
- *  the control2X and control2Y properties specify the second control point.
- *
- *  <p>Cubic bezier curves are not natively supported in Flash Player. This class does
- *  an approximation based on the fixed midpoint algorithm and uses 4 quadratic curves
- *  to simulate a cubic curve.</p>
- *
- *  <p>For details on the fixed midpoint algorithm, see:<br/>
- *  http://timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm</p>
- *  
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-class CubicBezierSegment extends PathSegment
-{
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Constructor.
-	 *  
-	 *  <p>For a CubicBezierSegment, there are two control points, each with x and y coordinates. Control points 
-	 *  are points that define the direction and amount of curves of a Bezier curve. 
-	 *  The curved line never reaches the control points; however, the line curves as though being drawn 
-	 *  toward the control point.</p>
-	 *  
-	 *  @param _control1X The x-axis location in 2-d coordinate space of the first control point.
-	 *  
-	 *  @param _control1Y The y-axis location of the first control point.
-	 *  
-	 *  @param _control2X The x-axis location of the second control point.
-	 *  
-	 *  @param _control2Y The y-axis location of the second control point.
-	 *  
-	 *  @param x The x-axis location of the starting point of the curve.
-	 *  
-	 *  @param y The y-axis location of the starting point of the curve.
-	 *  
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function CubicBezierSegment(
-		_control1X:Number = 0, _control1Y:Number = 0,
-		_control2X:Number = 0, _control2Y:Number = 0,
-		x:Number = 0, y:Number = 0)
-	{
-		super(x, y);
-		
-		control1X = _control1X;
-		control1Y = _control1Y;
-		control2X = _control2X;
-		control2Y = _control2Y;
-	}   
-	
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Variables
-	//
-	//--------------------------------------------------------------------------
-	
-	private var _qPts:QuadraticPoints;
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Properties
-	//
-	//--------------------------------------------------------------------------
-	
-	//----------------------------------
-	//  control1X
-	//----------------------------------
-	
-	/**
-	 *  The first control point x position.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var control1X:Number = 0;
-	
-	//----------------------------------
-	//  control1Y
-	//----------------------------------
-	
-	/**
-	 *  The first control point y position.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var control1Y:Number = 0;
-	
-	//----------------------------------
-	//  control2X
-	//----------------------------------
-	
-	/**
-	 *  The second control point x position.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var control2X:Number = 0;
-	
-	//----------------------------------
-	//  control2Y
-	//----------------------------------
-	
-	/**
-	 *  The second control point y position.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var control2Y:Number = 0;
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Draws the segment.
-	 *
-	 *  @param g The graphics context where the segment is drawn.
-	 *  
-	 *  @param prev The previous location of the pen.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	override public function draw(graphicsPath:GraphicsPath, dx:Number, dy:Number, sx:Number, sy:Number, prev:PathSegment):void
-	{
-		var qPts:QuadraticPoints = getQuadraticPoints(prev);
-		
-		graphicsPath.curveTo(dx + qPts.control1.x*sx, dy+qPts.control1.y*sy, dx+qPts.anchor1.x*sx, dy+qPts.anchor1.y*sy);
-		graphicsPath.curveTo(dx + qPts.control2.x*sx, dy+qPts.control2.y*sy, dx+qPts.anchor2.x*sx, dy+qPts.anchor2.y*sy);
-		graphicsPath.curveTo(dx + qPts.control3.x*sx, dy+qPts.control3.y*sy, dx+qPts.anchor3.x*sx, dy+qPts.anchor3.y*sy);
-		graphicsPath.curveTo(dx + qPts.control4.x*sx, dy+qPts.control4.y*sy, dx+qPts.anchor4.x*sx, dy+qPts.anchor4.y*sy);
-	}
-	
-	/**
-	 *  @inheritDoc
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number,
-											m:Matrix, rect:Rectangle):Rectangle
-	{
-		var qPts:QuadraticPoints = getQuadraticPoints(prev);
-		
-		rect = MatrixUtil.getQBezierSegmentBBox(prev ? prev.x : 0, prev ? prev.y : 0,
-			qPts.control1.x, qPts.control1.y,
-			qPts.anchor1.x, qPts.anchor1.y,
-			sx, sy, m, rect); 
-		
-		rect = MatrixUtil.getQBezierSegmentBBox(qPts.anchor1.x, qPts.anchor1.y,
-			qPts.control2.x, qPts.control2.y,
-			qPts.anchor2.x, qPts.anchor2.y,
-			sx, sy, m, rect); 
-		
-		rect = MatrixUtil.getQBezierSegmentBBox(qPts.anchor2.x, qPts.anchor2.y,
-			qPts.control3.x, qPts.control3.y,
-			qPts.anchor3.x, qPts.anchor3.y,
-			sx, sy, m, rect); 
-		
-		rect = MatrixUtil.getQBezierSegmentBBox(qPts.anchor3.x, qPts.anchor3.y,
-			qPts.control4.x, qPts.control4.y,
-			qPts.anchor4.x, qPts.anchor4.y,
-			sx, sy, m, rect); 
-		return rect;
-	}
-	
-	/**
-	 *  Returns the tangent for the segment. 
-	 *  @param prev The previous segment drawn, or null if this is the first segment.
-	 *  @param start If true, returns the tangent to the start point, otherwise the tangend to the end point.
-	 *  @param sx Pre-transform scale factor for x coordinates.
-	 *  @param sy Pre-transform scale factor for y coordinates.
-	 *  @param m Transformation matrix.
-	 *  @param result The tangent is returned as vector (x, y) in result.
-	 */
-	override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
-	{
-		// Get the approximation (we want the tangents to be the same as the ones we use to draw
-		var qPts:QuadraticPoints = getQuadraticPoints(prev);
-		
-		var pt0:Point = MatrixUtil.transformPoint(prev ? prev.x * sx : 0, prev ? prev.y * sy : 0, m).clone();
-		var pt1:Point = MatrixUtil.transformPoint(qPts.control1.x * sx, qPts.control1.y * sy, m).clone();
-		var pt2:Point = MatrixUtil.transformPoint(qPts.anchor1.x * sx, qPts.anchor1.y * sy, m).clone();
-		var pt3:Point = MatrixUtil.transformPoint(qPts.control2.x * sx, qPts.control2.y * sy, m).clone();
-		var pt4:Point = MatrixUtil.transformPoint(qPts.anchor2.x * sx, qPts.anchor2.y * sy, m).clone();
-		var pt5:Point = MatrixUtil.transformPoint(qPts.control3.x * sx, qPts.control3.y * sy, m).clone();
-		var pt6:Point = MatrixUtil.transformPoint(qPts.anchor3.x * sx, qPts.anchor3.y * sy, m).clone();
-		var pt7:Point = MatrixUtil.transformPoint(qPts.control4.x * sx, qPts.control4.y * sy, m).clone();
-		var pt8:Point = MatrixUtil.transformPoint(qPts.anchor4.x * sx, qPts.anchor4.y * sy, m).clone();
-		
-		if (start)
-		{
-			QuadraticBezierSegment.getQTangent(pt0.x, pt0.y, pt1.x, pt1.y, pt2.x, pt2.y, start, result);
-			// If there is no tangent
-			if (result.x == 0 && result.y == 0)
-			{
-				// Try 3 & 4
-				QuadraticBezierSegment.getQTangent(pt0.x, pt0.y, pt3.x, pt3.y, pt4.x, pt4.y, start, result);
-				
-				// If there is no tangent
-				if (result.x == 0 && result.y == 0)
-				{
-					// Try 5 & 6
-					QuadraticBezierSegment.getQTangent(pt0.x, pt0.y, pt5.x, pt5.y, pt6.x, pt6.y, start, result);
-					
-					// If there is no tangent
-					if (result.x == 0 && result.y == 0)
-						// Try 7 & 8
-						QuadraticBezierSegment.getQTangent(pt0.x, pt0.y, pt7.x, pt7.y, pt8.x, pt8.y, start, result);
-				}
-			}
-		}
-		else
-		{
-			QuadraticBezierSegment.getQTangent(pt6.x, pt6.y, pt7.x, pt7.y, pt8.x, pt8.y, start, result);
-			// If there is no tangent
-			if (result.x == 0 && result.y == 0)
-			{
-				// Try 4 & 5
-				QuadraticBezierSegment.getQTangent(pt4.x, pt4.y, pt5.x, pt5.y, pt8.x, pt8.y, start, result);
-				
-				// If there is no tangent
-				if (result.x == 0 && result.y == 0)
-				{
-					// Try 2 & 3
-					QuadraticBezierSegment.getQTangent(pt2.x, pt2.y, pt3.x, pt3.y, pt8.x, pt8.y, start, result);
-					
-					// If there is no tangent
-					if (result.x == 0 && result.y == 0)
-						// Try 0 & 1
-						QuadraticBezierSegment.getQTangent(pt0.x, pt0.y, pt1.x, pt1.y, pt8.x, pt8.y, start, result);
-				}
-			}
-		}
-	}    
-	
-	/** 
-	 *  @private
-	 *  Tim Groleau's method to approximate a cubic bezier with 4 quadratic beziers, 
-	 *  with endpoint and control point of each saved. 
-	 */
-	private function getQuadraticPoints(prev:PathSegment):QuadraticPoints
-	{
-		if (_qPts)
-			return _qPts;
-		
-		var p1:Point = new Point(prev ? prev.x : 0, prev ? prev.y : 0);
-		var p2:Point = new Point(x, y);
-		var c1:Point = new Point(control1X, control1Y);     
-		var c2:Point = new Point(control2X, control2Y);
-		
-		// calculates the useful base points
-		var PA:Point = Point.interpolate(c1, p1, 3/4);
-		var PB:Point = Point.interpolate(c2, p2, 3/4);
-		
-		// get 1/16 of the [p2, p1] segment
-		var dx:Number = (p2.x - p1.x) / 16;
-		var dy:Number = (p2.y - p1.y) / 16;
-		
-		_qPts = new QuadraticPoints;
-		
-		// calculates control point 1
-		_qPts.control1 = Point.interpolate(c1, p1, 3/8);
-		
-		// calculates control point 2
-		_qPts.control2 = Point.interpolate(PB, PA, 3/8);
-		_qPts.control2.x -= dx;
-		_qPts.control2.y -= dy;
-		
-		// calculates control point 3
-		_qPts.control3 = Point.interpolate(PA, PB, 3/8);
-		_qPts.control3.x += dx;
-		_qPts.control3.y += dy;
-		
-		// calculates control point 4
-		_qPts.control4 = Point.interpolate(c2, p2, 3/8);
-		
-		// calculates the 3 anchor points
-		_qPts.anchor1 = Point.interpolate(_qPts.control1, _qPts.control2, 0.5); 
-		_qPts.anchor2 = Point.interpolate(PA, PB, 0.5); 
-		_qPts.anchor3 = Point.interpolate(_qPts.control3, _qPts.control4, 0.5); 
-		
-		// the 4th anchor point is p2
-		_qPts.anchor4 = p2;
-		
-		return _qPts;      
-	}
-}
-
-//--------------------------------------------------------------------------
-//
-//  Internal Helper Class - QuadraticPoints  
-//
-//--------------------------------------------------------------------------
-import flash.geom.Point;
-
-/**
- *  Utility class to store the computed quadratic points.
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-class QuadraticPoints
-{
-	public var control1:Point;
-	public var anchor1:Point;
-	public var control2:Point;
-	public var anchor2:Point;
-	public var control3:Point;
-	public var anchor3:Point;
-	public var control4:Point;
-	public var anchor4:Point;
-	
-	/**
-	 * Constructor.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function QuadraticPoints()
-	{
-		super();
-	}
-}
-
-//--------------------------------------------------------------------------
-//
-//  Internal Helper Class - QuadraticBezierSegment 
-//
-//--------------------------------------------------------------------------
-import flash.display.GraphicsPath;
-import flash.geom.Matrix;
-import flash.geom.Point;
-import flash.geom.Rectangle;
-
-import org.apache.flex.core.graphics.utils.MatrixUtil;
-
-/**
- *  The QuadraticBezierSegment draws a quadratic curve from the current pen position 
- *  to x, y. 
- *
- *  Quadratic bezier is the native curve type
- *  in Flash Player.
- *  
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-class QuadraticBezierSegment extends PathSegment
-{
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Constructor.
-	 *  
-	 *  <p>For a QuadraticBezierSegment, there is one control point. A control point
-	 *  is a point that defines the direction and amount of a Bezier curve. 
-	 *  The curved line never reaches the control point; however, the line curves as though being drawn 
-	 *  toward the control point.</p>
-	 * 
-	 *  @param _control1X The x-axis location in 2-d coordinate space of the control point.
-	 *  
-	 *  @param _control1Y The y-axis location in 2-d coordinate space of the control point.
-	 *  
-	 *  @param x The x-axis location of the starting point of the curve.
-	 *  
-	 *  @param y The y-axis location of the starting point of the curve.
-	 * 
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function QuadraticBezierSegment(
-		_control1X:Number = 0, _control1Y:Number = 0, 
-		x:Number = 0, y:Number = 0)
-	{
-		super(x, y);
-		
-		control1X = _control1X;
-		control1Y = _control1Y;
-	}   
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Properties
-	//
-	//--------------------------------------------------------------------------
-	
-	//----------------------------------
-	//  control1X
-	//----------------------------------
-	
-	/**
-	 *  The control point's x position.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var control1X:Number = 0;
-	
-	//----------------------------------
-	//  control1Y
-	//----------------------------------
-	
-	/**
-	 *  The control point's y position.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public var control1Y:Number = 0;
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  Draws the segment using the control point location and the x and y coordinates. 
-	 *  This method calls the <code>Graphics.curveTo()</code> method.
-	 *  
-	 *  @see flash.display.Graphics
-	 *
-	 *  @param g The graphics context where the segment is drawn.
-	 *  
-	 *  @param prev The previous location of the pen.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
-	{
-		graphicsPath.curveTo(dx+control1X*sx, dy+control1Y*sy, dx+x*sx, dy+y*sy);
-	}
-	
-	static public function getQTangent(x0:Number, y0:Number,
-									   x1:Number, y1:Number,
-									   x2:Number, y2:Number,
-									   start:Boolean,
-									   result:Point):void
-	{
-		if (start)
-		{
-			if (x0 == x1 && y0 == y1)
-			{
-				result.x = x2 - x0;
-				result.y = y2 - y0;
-			}
-			else
-			{
-				result.x = x1 - x0;
-				result.y = y1 - y0;
-			}
-		}
-		else
-		{
-			if (x2 == x1 && y2 == y1)
-			{
-				result.x = x2 - x0;
-				result.y = y2 - y0;
-			}
-			else
-			{
-				result.x = x2 - x1;
-				result.y = y2 - y1;
-			}
-		}
-	}
-	
-	/**
-	 *  Returns the tangent for the segment. 
-	 *  @param prev The previous segment drawn, or null if this is the first segment.
-	 *  @param start If true, returns the tangent to the start point, otherwise the tangend to the end point.
-	 *  @param sx Pre-transform scale factor for x coordinates.
-	 *  @param sy Pre-transform scale factor for y coordinates.
-	 *  @param m Transformation matrix.
-	 *  @param result The tangent is returned as vector (x, y) in result.
-	 */
-	override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
-	{
-		var pt0:Point = MatrixUtil.transformPoint(prev ? prev.x * sx : 0, prev ? prev.y * sy : 0, m).clone();
-		var pt1:Point = MatrixUtil.transformPoint(control1X * sx, control1Y * sy, m).clone();;
-		var pt2:Point = MatrixUtil.transformPoint(x * sx, y * sy, m).clone();
-		
-		getQTangent(pt0.x, pt0.y, pt1.x, pt1.y, pt2.x, pt2.y, start, result);
-	}
-	
-	/**
-	 *  @inheritDoc
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number,
-											m:Matrix, rect:Rectangle):Rectangle
-	{
-		return MatrixUtil.getQBezierSegmentBBox(prev ? prev.x : 0, prev ? prev.y : 0,
-			control1X, control1Y, x, y, sx, sy, m, rect);
-	}
-}
-
-
-/**
- *  The EllipticalArcSegment draws an arc from the current point to a specified point. 
- *  The arc command begins with the x and y radius and ends with the ending point of the arc. 
- *  Between these are three other values: x axis rotation, large arc flag and sweep flag. 
- *  The x axis rotation is used to rotate the ellipse that the arc is created from. 
- *  This rotation maintains the start and end points, whereas a rotation with the transform 
- *  attribute (outside the path description) would cause the entire path, including the start 
- *  and end points, to be rotated. The large arc flag and sweep flag control which part of 
- *  the ellipse is used to cut the arc. These are needed because there's more than one way 
- *  to place an ellipse so that it includes the start and end points.
- *
- *  
- *  Derieved from the svgweb library
- *  Original found here https://code.google.com/p/svgweb/source/browse/trunk/src/org/svgweb/utils/EllipticalArc.as?r=1251
- *  
- *  
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-class EllipticalArcSegment extends PathSegment
-{
-	
-	private var _rx:Number;
-	private var _ry:Number;
-	private var _angle:Number;
-	private var _largeArcFlag:Boolean;
-	private var _sweepFlag:Boolean;
-	private var _endX:Number;
-	private var _endY:Number;
-	
-	/**
-	 *  Constructor.
-	 *  
-	 * 
-     * @param rx x radius
-     *
-     * @param ry y radius
-     *
-     * @param angle angle of rotation from the x-axis
-     *
-     * @param largeArcFlag true if arc is greater than 180 degrees
-     *
-     * @param sweepFlag determines if the arc proceeds in a postitive or negative radial direction
-     *
-     * @param x arc end x value
-     *
-     * @param y arc end y value
-     *
-     * @param LastPointX starting x value of arc
-     *
-     * @param LastPointY starting y value of arc
-	 * 
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10
-	 *  @playerversion AIR 1.5
-	 *  @productversion Flex 4
-	 */
-	public function EllipticalArcSegment(rx:Number, ry:Number, angle:Number, largeArcFlag:Boolean, sweepFlag:Boolean, endX:Number, endY:Number)
-	{
-		_rx = rx;
-		_ry = ry;
-		_angle = angle;
-		_largeArcFlag = largeArcFlag;
-		_sweepFlag = sweepFlag;
-		_endX = endX;
-		_endY = endY;
-	}
-	
-	override public function draw(graphicsPath:GraphicsPath, dx:Number, dy:Number, sx:Number, sy:Number, prev:PathSegment):void
-	{
-		var ellipticalArc:Object = computeSvgArc(_rx, _ry, _angle, _largeArcFlag, _sweepFlag, dx + _endX, dy + _endY, dx + prev.x , dy + prev.y);    
-		drawEllipticalArc(ellipticalArc.cx, ellipticalArc.cy, ellipticalArc.startAngle, ellipticalArc.arc, ellipticalArc.radius, ellipticalArc.yRadius, ellipticalArc.xAxisRotation, graphicsPath);
-	}
-	
-	/**
-	 * @private
-	 * Create quadratic circle graphics commands from an elliptical arc
-	 **/
-	private static function drawEllipticalArc(x:Number, y:Number, startAngle:Number, arc:Number,
-											  radius:Number, yRadius:Number, xAxisRotation:Number, path:GraphicsPath):void
-	{
-		// Circumvent drawing more than is needed
-		if (Math.abs(arc)>360)
-		{
-			arc = 360;
-		}          
-		
-		// Draw in a maximum of 45 degree segments. First we calculate how many
-		// segments are needed for our arc.
-		var segs:Number = Math.ceil(Math.abs(arc)/45);          
-		
-		// Now calculate the sweep of each segment
-		var segAngle:Number = arc/segs;        
-		
-		var theta:Number = degreesToRadians(segAngle);
-		var angle:Number = degreesToRadians(startAngle);
-		
-		// Draw as 45 degree segments
-		if (segs>0)
-		{                
-			var beta:Number = degreesToRadians(xAxisRotation);
-			var sinbeta:Number = Math.sin(beta);
-			var cosbeta:Number = Math.cos(beta);
 			
-			var cx:Number;
-			var cy:Number;
-			var x1:Number;
-			var y1:Number;
-			
-			// Loop for drawing arc segments
-			for (var i:int = 0; i<segs; i++) {
-				
-				angle += theta;
-				
-				var sinangle:Number = Math.sin(angle-(theta/2));
-				var cosangle:Number = Math.cos(angle-(theta/2));
-				
-				var div:Number = Math.cos(theta/2);
-				cx = x + (radius * cosangle * cosbeta - yRadius * sinangle * sinbeta)/div; //Why divide by Math.cos(theta/2)? - FIX THIS
-				cy = y + (radius * cosangle * sinbeta + yRadius * sinangle * cosbeta)/div; //Why divide by Math.cos(theta/2)? - FIX THIS                    
-				
-				sinangle = Math.sin(angle);
-				cosangle = Math.cos(angle);                
-				
-				x1 = x + (radius * cosangle * cosbeta - yRadius * sinangle * sinbeta);
-				y1 = y + (radius * cosangle * sinbeta + yRadius * sinangle * cosbeta);
-				
-				path.curveTo(cx, cy, x1, y1);
-			}
-		}
-	}
-
-	
-	private function computeSvgArc(rx:Number, ry:Number,angle:Number,largeArcFlag:Boolean,sweepFlag:Boolean,
-										 x:Number,y:Number,LastPointX:Number, LastPointY:Number):Object {
-		//store before we do anything with it    
-		var xAxisRotation:Number = angle;    
-		
-		// Compute the half distance between the current and the final point
-		var dx2:Number = (LastPointX - x) / 2.0;
-		var dy2:Number = (LastPointY - y) / 2.0;
-		
-		// Convert angle from degrees to radians
-		angle = degreesToRadians(angle);
-		var cosAngle:Number = Math.cos(angle);
-		var sinAngle:Number = Math.sin(angle);
-		
-		
-		//Compute (x1, y1)
-		var x1:Number = (cosAngle * dx2 + sinAngle * dy2);
-		var y1:Number = (-sinAngle * dx2 + cosAngle * dy2);
-		
-		// Ensure radii are large enough
-		rx = Math.abs(rx);
-		ry = Math.abs(ry);
-		var Prx:Number = rx * rx;
-		var Pry:Number = ry * ry;
-		var Px1:Number = x1 * x1;
-		var Py1:Number = y1 * y1;
-		
-		// check that radii are large enough
-		var radiiCheck:Number = Px1/Prx + Py1/Pry;
-		if (radiiCheck > 1) {
-			rx = Math.sqrt(radiiCheck) * rx;
-			ry = Math.sqrt(radiiCheck) * ry;
-			Prx = rx * rx;
-			Pry = ry * ry;
-		}
-		
-		
-		//Compute (cx1, cy1)
-		var sign:Number = (largeArcFlag == sweepFlag) ? -1 : 1;
-		var sq:Number = ((Prx*Pry)-(Prx*Py1)-(Pry*Px1)) / ((Prx*Py1)+(Pry*Px1));
-		sq = (sq < 0) ? 0 : sq;
-		var coef:Number = (sign * Math.sqrt(sq));
-		var cx1:Number = coef * ((rx * y1) / ry);
-		var cy1:Number = coef * -((ry * x1) / rx);
-		
-		
-		//Compute (cx, cy) from (cx1, cy1)
-		var sx2:Number = (LastPointX + x) / 2.0;
-		var sy2:Number = (LastPointY + y) / 2.0;
-		var cx:Number = sx2 + (cosAngle * cx1 - sinAngle * cy1);
-		var cy:Number = sy2 + (sinAngle * cx1 + cosAngle * cy1);
-		
-		
-		//Compute the angleStart (angle1) and the angleExtent (dangle)
-		var ux:Number = (x1 - cx1) / rx;
-		var uy:Number = (y1 - cy1) / ry;
-		var vx:Number = (-x1 - cx1) / rx;
-		var vy:Number = (-y1 - cy1) / ry;
-		var p:Number
-		var n:Number
-		
-		//Compute the angle start
-		n = Math.sqrt((ux * ux) + (uy * uy));
-		p = ux;
-		
-		sign = (uy < 0) ? -1.0 : 1.0;
-		
-		var angleStart:Number = radiansToDegrees(sign * Math.acos(p / n));
-		
-		// Compute the angle extent
-		n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy));
-		p = ux * vx + uy * vy;
-		sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0;
-		var angleExtent:Number = radiansToDegrees(sign * Math.acos(p / n));
-		
-		if(!sweepFlag && angleExtent > 0)
-		{
-			angleExtent -= 360;
-		}
-		else if (sweepFlag && angleExtent < 0)
-		{
-			angleExtent += 360;
 		}
-		
-		angleExtent %= 360;
-		angleStart %= 360;
-		
-		//return Object({x:LastPointX,y:LastPointY,startAngle:angleStart,arc:angleExtent,radius:rx,yRadius:ry,xAxisRotation:xAxisRotation});        
-		return Object({x:LastPointX,y:LastPointY,startAngle:angleStart,arc:angleExtent,radius:rx,yRadius:ry,xAxisRotation:xAxisRotation, cx:cx,cy:cy});
-	}
-
-	/**
-	 * @private
-	 * Convert degrees to radians
-	 **/
-	private static function degreesToRadians(angle:Number):Number{
-		return angle*(Math.PI/180);
 	}
-	
-	/**
-	 * @private
-	 * Convert radiansToDegrees
-	 **/
-	private static function radiansToDegrees(angle:Number):Number{
-		return angle*(180/Math.PI);
-	}
-
-	
 }
-

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
index 6d82bf6..d30a599 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
@@ -1,7 +1,22 @@
+/**
+ * Licensed 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.core.graphics
 {
 	import flash.display.CapsStyle;
 	import flash.display.JointStyle;
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 
 	public class Rect extends GraphicShape
@@ -23,7 +38,7 @@ package org.apache.flex.core.graphics
 		{
 			graphics.clear();
 			applyStroke();
-			beginFill(new Rectangle(x, y, width, height));
+			beginFill(new Rectangle(x, y, width, height), new Point(x,y));
 			graphics.drawRect(x, y, width, height);
 			endFill();
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9999c237/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
index bc0d913..bde4715 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/SolidColor.as
@@ -14,6 +14,7 @@
 
 package org.apache.flex.core.graphics
 {
+	import flash.geom.Point;
 	import flash.geom.Rectangle;
 
 	public class SolidColor implements IFill
@@ -77,7 +78,7 @@ package org.apache.flex.core.graphics
 			}
 		}
 		
-		public function begin(s:GraphicShape,targetBounds:Rectangle):void
+		public function begin(s:GraphicShape,targetBounds:Rectangle,targetOrigin:Point):void
 		{
 			s.graphics.beginFill(color,alpha);
 		}


[4/7] git commit: [flex-asjs] [refs/heads/develop] - Add fix for non-Chrome browsers

Posted by bi...@apache.org.
Add fix for non-Chrome browsers


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/69295172
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/69295172
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/69295172

Branch: refs/heads/develop
Commit: 692951725d58437756bf2564be97c3623f360501
Parents: b330ab1
Author: Om <bi...@gmail.com>
Authored: Tue Sep 16 18:21:14 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Tue Sep 16 18:24:46 2014 -0700

----------------------------------------------------------------------
 .../org/apache/flex/core/graphics/GraphicsContainer.js  |  8 ++++----
 .../js/FlexJS/src/org/apache/flex/core/graphics/Rect.js | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/69295172/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
index 9af3541..3b1197a 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
@@ -49,10 +49,10 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.drawRect = function(x,
   var style = this.getStyleStr();
   var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
   rect.setAttribute('style', style);
-  rect.setAttribute('x', String(x));
-  rect.setAttribute('y', String(y));
-  rect.setAttribute('width', String(width));
-  rect.setAttribute('height', String(height));
+  rect.setAttribute('x', String(x) + 'px');
+  rect.setAttribute('y', String(y) + 'px');
+  rect.setAttribute('width', String(width) + 'px');
+  rect.setAttribute('height', String(height) + 'px');
   this.element.appendChild(rect);
 };
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/69295172/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
index bc3364a..01f784c 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
@@ -53,17 +53,17 @@ org.apache.flex.core.graphics.Rect.prototype.drawRect = function(x, y, width, he
     rect.setAttribute('style', style);
     if (this.get_stroke())
     {
-      rect.setAttribute('x', String(this.get_stroke().get_weight() / 2));
-      rect.setAttribute('y', String(this.get_stroke().get_weight() / 2));
+      rect.setAttribute('x', String(this.get_stroke().get_weight() / 2) + 'px');
+      rect.setAttribute('y', String(this.get_stroke().get_weight() / 2) + 'px');
       this.setPosition(x, y, this.get_stroke().get_weight(), this.get_stroke().get_weight());
     }
     else
     {
-      rect.setAttribute('x', '0');
-      rect.setAttribute('y', '0');
+      rect.setAttribute('x', '0' + 'px');
+      rect.setAttribute('y', '0' + 'px');
       this.setPosition(x, y, 0, 0);
     }
-    rect.setAttribute('width', String(width));
-    rect.setAttribute('height', String(height));
+    rect.setAttribute('width', String(width) + 'px');
+    rect.setAttribute('height', String(height) + 'px');
     this.element.appendChild(rect);
   };