You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2017/02/22 15:36:43 UTC
[4/8] flex-asjs git commit: Initial project setup from Lizhi’s SpriteFlexJS project
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/KeyboardEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/KeyboardEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/KeyboardEvent.as
new file mode 100644
index 0000000..cedbd23
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/KeyboardEvent.as
@@ -0,0 +1,111 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+ public class KeyboardEvent extends Event
+ {
+
+ public static const KEY_DOWN:String = "keyDown";
+
+ public static const KEY_UP:String = "keyUp";
+
+ private var m_keyLocation:uint;
+ private var m_keyCode:uint;
+ private var m_ctrlKey:Boolean;
+ private var m_altKey:Boolean;
+ private var m_shiftKey:Boolean;
+
+ public function KeyboardEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false, charCodeValue:uint = 0, keyCodeValue:uint = 0, keyLocationValue:uint = 0, ctrlKeyValue:Boolean = false, altKeyValue:Boolean = false, shiftKeyValue:Boolean = false)
+ {
+ super(type,bubbles,cancelable);
+ this.charCode = charCodeValue;
+ this.keyCode = keyCodeValue;
+ this.keyLocation = keyLocationValue;
+ this.ctrlKey = ctrlKeyValue;
+ this.altKey = altKeyValue;
+ this.shiftKey = shiftKeyValue;
+ }
+
+ override public function clone() : Event
+ {
+ return new KeyboardEvent(type,bubbles,cancelable,this.charCode,this.keyCode,this.keyLocation,this.ctrlKey,this.altKey,this.shiftKey);
+ }
+
+ override public function toString() : String
+ {
+ return formatToString("KeyboardEvent","type","bubbles","cancelable","eventPhase","charCode","keyCode","keyLocation","ctrlKey","altKey","shiftKey");
+ }
+
+ public function get charCode() : uint{return 0}
+
+ public function set charCode(param1:uint) : void{}
+
+ public function get keyCode() : uint
+ {
+ return this.m_keyCode;
+ }
+
+ public function set keyCode(value:uint) : void
+ {
+ this.m_keyCode = value;
+ }
+
+ public function get keyLocation() : uint
+ {
+ return this.m_keyLocation;
+ }
+
+ public function set keyLocation(value:uint) : void
+ {
+ this.m_keyLocation = value;
+ }
+
+ public function get ctrlKey() : Boolean
+ {
+ return m_ctrlKey;
+ }
+
+ public function set ctrlKey(param1:Boolean) : void
+ {
+ m_ctrlKey = param1;
+ }
+
+ public function get altKey() : Boolean
+ {
+ return m_altKey;
+ }
+
+ public function set altKey(param1:Boolean) : void
+ {
+ m_altKey = param1;
+ }
+
+ public function get shiftKey() : Boolean
+ {
+ return m_shiftKey;
+ }
+
+ public function set shiftKey(param1:Boolean) : void
+ {
+ m_shiftKey = param1;
+ }
+
+ public function updateAfterEvent() : void{}
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/MouseEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/MouseEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/MouseEvent.as
new file mode 100644
index 0000000..3b22407
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/MouseEvent.as
@@ -0,0 +1,217 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+
+ public class MouseEvent extends Event
+ {
+
+ public static const CLICK:String = "click";
+
+ public static const DOUBLE_CLICK:String = "doubleClick";
+
+ public static const MOUSE_DOWN:String = "mouseDown";
+
+ public static const MOUSE_MOVE:String = "mouseMove";
+
+ public static const MOUSE_OUT:String = "mouseOut";
+
+ public static const MOUSE_OVER:String = "mouseOver";
+
+ public static const MOUSE_UP:String = "mouseUp";
+
+ public static const RELEASE_OUTSIDE:String = "releaseOutside";
+
+ public static const MOUSE_WHEEL:String = "mouseWheel";
+
+ public static const ROLL_OUT:String = "rollOut";
+
+ public static const ROLL_OVER:String = "rollOver";
+
+ public static const MIDDLE_CLICK:String = "middleClick";
+
+ public static const MIDDLE_MOUSE_DOWN:String = "middleMouseDown";
+
+ public static const MIDDLE_MOUSE_UP:String = "middleMouseUp";
+
+ public static const RIGHT_CLICK:String = "rightClick";
+
+ public static const RIGHT_MOUSE_DOWN:String = "rightMouseDown";
+
+ public static const RIGHT_MOUSE_UP:String = "rightMouseUp";
+
+ public static const CONTEXT_MENU:String = "contextMenu";
+
+ private var m_relatedObject:Object;
+
+ private var m_ctrlKey:Boolean;
+
+ private var m_altKey:Boolean;
+
+ private var m_shiftKey:Boolean;
+
+ private var m_buttonDown:Boolean;
+
+ private var m_delta:int;
+
+ private var m_isRelatedObjectInaccessible:Boolean;
+
+ private var _localX:Number = 0;
+ private var _localY:Number = 0;
+
+ public function MouseEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false, localX:Number = undefined, localY:Number = undefined, relatedObject:Object = null, ctrlKey:Boolean = false, altKey:Boolean = false, shiftKey:Boolean = false, buttonDown:Boolean = false, delta:int = 0)
+ {
+ super(type, bubbles, cancelable);
+ _localX = localX;
+ _localY = localY;
+ this.m_relatedObject = relatedObject;
+ this.m_ctrlKey = ctrlKey;
+ this.m_altKey = altKey;
+ this.m_shiftKey = shiftKey;
+ this.m_buttonDown = buttonDown;
+ this.m_delta = delta;
+ }
+
+ override public function clone():Event
+ {
+ return new MouseEvent(type, bubbles, cancelable, this.localX, this.localY, this.m_relatedObject, this.m_ctrlKey, this.m_altKey, this.m_shiftKey, this.m_buttonDown, this.m_delta);
+ }
+
+ override public function toString():String
+ {
+ return formatToString("MouseEvent", "type", "bubbles", "cancelable", "eventPhase", "localX", "localY", "stageX", "stageY", "relatedObject", "ctrlKey", "altKey", "shiftKey", "buttonDown", "delta");
+ }
+
+ public function get localX():Number { return _localX; }
+
+ public function set localX(v:Number):void { _localX = v; }
+
+ public function get localY():Number { return _localY }
+
+ public function set localY(v:Number):void { _localY = v; }
+
+ public function get relatedObject():Object
+ {
+ return this.m_relatedObject;
+ }
+
+ public function set relatedObject(value:Object):void
+ {
+ this.m_relatedObject = value;
+ }
+
+ public function get ctrlKey():Boolean
+ {
+ return this.m_ctrlKey;
+ }
+
+ public function set ctrlKey(value:Boolean):void
+ {
+ this.m_ctrlKey = value;
+ }
+
+ public function get altKey():Boolean
+ {
+ return this.m_altKey;
+ }
+
+ public function set altKey(value:Boolean):void
+ {
+ this.m_altKey = value;
+ }
+
+ public function get shiftKey():Boolean
+ {
+ return this.m_shiftKey;
+ }
+
+ public function set shiftKey(value:Boolean):void
+ {
+ this.m_shiftKey = value;
+ }
+
+ public function get buttonDown():Boolean
+ {
+ return this.m_buttonDown;
+ }
+
+ public function set buttonDown(value:Boolean):void
+ {
+ this.m_buttonDown = value;
+ }
+
+ public function get delta():int
+ {
+ return this.m_delta;
+ }
+
+ public function set delta(value:int):void
+ {
+ this.m_delta = value;
+ }
+
+ public function get stageX():Number
+ {
+ if (isNaN(this.localX) || isNaN(this.localY))
+ {
+ return Number.NaN;
+ }
+ return this.getStageX();
+ }
+
+ public function get stageY():Number
+ {
+ if (isNaN(this.localX) || isNaN(this.localY))
+ {
+ return Number.NaN;
+ }
+ return this.getStageY();
+ }
+
+ public function updateAfterEvent():void
+ {
+ }
+
+ private function getStageX():Number { return 0 }
+
+ private function getStageY():Number { return 0 }
+
+ public function get isRelatedObjectInaccessible():Boolean
+ {
+ return this.m_isRelatedObjectInaccessible;
+ }
+
+ public function set isRelatedObjectInaccessible(value:Boolean):void
+ {
+ this.m_isRelatedObjectInaccessible = value;
+ }
+
+ public function get movementX():Number { return 0 }
+
+ public function set movementX(param1:Number):void
+ {
+ }
+
+ public function get movementY():Number { return 0 }
+
+ public function set movementY(param1:Number):void
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/ProgressEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/ProgressEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/ProgressEvent.as
new file mode 100644
index 0000000..54af3a7
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/ProgressEvent.as
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+
+ public class ProgressEvent extends Event
+ {
+
+ public static const PROGRESS:String = "progress";
+
+ public static const SOCKET_DATA:String = "socketData";
+
+ private var m_bytesLoaded:Number;
+
+ private var m_bytesTotal:Number;
+
+ public function ProgressEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, bytesLoaded:Number = 0, bytesTotal:Number = 0)
+ {
+ super(type, bubbles, cancelable);
+ this.m_bytesLoaded = bytesLoaded;
+ this.m_bytesTotal = bytesTotal;
+ }
+
+ override public function clone():Event
+ {
+ return new ProgressEvent(type, bubbles, cancelable, this.m_bytesLoaded, this.m_bytesTotal);
+ }
+
+ override public function toString():String
+ {
+ return formatToString("ProgressEvent", "type", "bubbles", "cancelable", "eventPhase", "bytesLoaded", "bytesTotal");
+ }
+
+ public function get bytesLoaded():Number
+ {
+ return this.m_bytesLoaded;
+ }
+
+ public function set bytesLoaded(value:Number):void
+ {
+ this.m_bytesLoaded = value;
+ }
+
+ public function get bytesTotal():Number
+ {
+ return this.m_bytesTotal;
+ }
+
+ public function set bytesTotal(value:Number):void
+ {
+ this.m_bytesTotal = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/SecurityErrorEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/SecurityErrorEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/SecurityErrorEvent.as
new file mode 100644
index 0000000..b8a90cd
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/SecurityErrorEvent.as
@@ -0,0 +1,41 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+ public class SecurityErrorEvent extends ErrorEvent
+ {
+
+ public static const SECURITY_ERROR:String = "securityError";
+
+ public function SecurityErrorEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, text:String = "", id:int = 0)
+ {
+ super(type,bubbles,cancelable,text,id);
+ }
+
+ override public function clone() : Event
+ {
+ return new SecurityErrorEvent(type,bubbles,cancelable,text,errorID);
+ }
+
+ override public function toString() : String
+ {
+ return formatToString("SecurityErrorEvent","type","bubbles","cancelable","eventPhase","text");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TextEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TextEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TextEvent.as
new file mode 100644
index 0000000..e5e91e0
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TextEvent.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+ public class TextEvent extends Event
+ {
+
+ public static const LINK:String = "link";
+
+ public static const TEXT_INPUT:String = "textInput";
+
+ private var m_text:String;
+
+ public function TextEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, text:String = "")
+ {
+ super(type,bubbles,cancelable);
+ this.m_text = text;
+ }
+
+ public function get text() : String
+ {
+ return this.m_text;
+ }
+
+ public function set text(value:String) : void
+ {
+ this.m_text = value;
+ }
+
+ override public function clone() : Event
+ {
+ var te:TextEvent = new TextEvent(type,bubbles,cancelable,this.m_text);
+ te.copyNativeData(this);
+ return te;
+ }
+
+ override public function toString() : String
+ {
+ return formatToString("TextEvent","type","bubbles","cancelable","eventPhase","text");
+ }
+
+ private function copyNativeData(param1:TextEvent) : void{}
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TimerEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TimerEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TimerEvent.as
new file mode 100644
index 0000000..5129af8
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TimerEvent.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+
+ public class TimerEvent extends Event
+ {
+
+ public static const TIMER:String = "timer";
+
+ public static const TIMER_COMPLETE:String = "timerComplete";
+
+ public function TimerEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false)
+ {
+ super(type, bubbles, cancelable);
+ }
+
+ override public function clone():Event
+ {
+ return new TimerEvent(type, bubbles, cancelable);
+ }
+
+ override public function toString():String
+ {
+ return formatToString("TimerEvent", "type", "bubbles", "cancelable", "eventPhase");
+ }
+
+ public function updateAfterEvent():void
+ {
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TouchEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TouchEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TouchEvent.as
new file mode 100644
index 0000000..5271fb5
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/TouchEvent.as
@@ -0,0 +1,232 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+ public class TouchEvent extends Event
+ {
+
+ public static const TOUCH_BEGIN:String = "touchBegin";
+
+ public static const TOUCH_END:String = "touchEnd";
+
+ public static const TOUCH_MOVE:String = "touchMove";
+
+ public static const TOUCH_OVER:String = "touchOver";
+
+ public static const TOUCH_OUT:String = "touchOut";
+
+ public static const TOUCH_ROLL_OVER:String = "touchRollOver";
+
+ public static const TOUCH_ROLL_OUT:String = "touchRollOut";
+
+ public static const TOUCH_TAP:String = "touchTap";
+
+ public static const PROXIMITY_BEGIN:String = "proximityBegin";
+
+ public static const PROXIMITY_END:String = "proximityEnd";
+
+ public static const PROXIMITY_MOVE:String = "proximityMove";
+
+ public static const PROXIMITY_OUT:String = "proximityOut";
+
+ public static const PROXIMITY_OVER:String = "proximityOver";
+
+ public static const PROXIMITY_ROLL_OUT:String = "proximityRollOut";
+
+ public static const PROXIMITY_ROLL_OVER:String = "proximityRollOver";
+
+ private var m_touchPointID:int;
+
+ private var m_isPrimaryTouchPoint:Boolean;
+
+ private var m_sizeY:Number;
+
+ private var m_sizeX:Number;
+
+ private var m_pressure:Number;
+
+ private var m_relatedObject:Object;
+
+ private var m_isRelatedObjectInaccessible:Boolean;
+
+ private var m_ctrlKey:Boolean;
+
+ private var m_altKey:Boolean;
+
+ private var m_shiftKey:Boolean;
+
+ public function TouchEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false, touchPointID:int = 0, isPrimaryTouchPoint:Boolean = false, localX:Number = NaN, localY:Number = NaN, sizeX:Number = NaN, sizeY:Number = NaN, pressure:Number = NaN, relatedObject:Object = null, ctrlKey:Boolean = false, altKey:Boolean = false, shiftKey:Boolean = false)
+ {
+ super(type,bubbles,cancelable);
+ this.m_touchPointID = touchPointID;
+ this.m_isPrimaryTouchPoint = isPrimaryTouchPoint;
+ this.localX = localX;
+ this.localY = localY;
+ this.m_sizeX = sizeX;
+ this.m_sizeY = sizeY;
+ this.m_pressure = pressure;
+ this.m_relatedObject = relatedObject;
+ this.m_ctrlKey = ctrlKey;
+ this.m_altKey = altKey;
+ this.m_shiftKey = shiftKey;
+ }
+
+ override public function clone() : Event
+ {
+ return new TouchEvent(type,bubbles,cancelable,this.m_touchPointID,this.m_isPrimaryTouchPoint,this.localX,this.localY,this.m_sizeX,this.m_sizeY,this.m_pressure,this.m_relatedObject,this.m_ctrlKey,this.m_altKey,this.m_shiftKey);
+ }
+
+ override public function toString() : String
+ {
+ return formatToString("TouchEvent","type","bubbles","cancelable","eventPhase","touchPointID","isPrimaryTouchPoint","localX","localY","stageX","stageY","sizeX","sizeY","pressure","relatedObject","ctrlKey","altKey","shiftKey");
+ }
+
+ public function get localX() : Number{return 0}
+
+ public function set localX(param1:Number) : void{}
+
+ public function get localY() : Number{return 0}
+
+ public function set localY(param1:Number) : void{}
+
+ public function get touchPointID() : int
+ {
+ return this.m_touchPointID;
+ }
+
+ public function set touchPointID(value:int) : void
+ {
+ this.m_touchPointID = value;
+ }
+
+ public function get isPrimaryTouchPoint() : Boolean
+ {
+ return this.m_isPrimaryTouchPoint;
+ }
+
+ public function set isPrimaryTouchPoint(value:Boolean) : void
+ {
+ this.m_isPrimaryTouchPoint = value;
+ }
+
+ public function get sizeX() : Number
+ {
+ return this.m_sizeX;
+ }
+
+ public function set sizeX(value:Number) : void
+ {
+ this.m_sizeX = value;
+ }
+
+ public function get sizeY() : Number
+ {
+ return this.m_sizeY;
+ }
+
+ public function set sizeY(value:Number) : void
+ {
+ this.m_sizeY = value;
+ }
+
+ public function get pressure() : Number
+ {
+ return this.m_pressure;
+ }
+
+ public function set pressure(value:Number) : void
+ {
+ this.m_pressure = value;
+ }
+
+ public function get relatedObject() : Object
+ {
+ return this.m_relatedObject;
+ }
+
+ public function set relatedObject(value:Object) : void
+ {
+ this.m_relatedObject = value;
+ }
+
+ public function get ctrlKey() : Boolean
+ {
+ return this.m_ctrlKey;
+ }
+
+ public function set ctrlKey(value:Boolean) : void
+ {
+ this.m_ctrlKey = value;
+ }
+
+ public function get altKey() : Boolean
+ {
+ return this.m_altKey;
+ }
+
+ public function set altKey(value:Boolean) : void
+ {
+ this.m_altKey = value;
+ }
+
+ public function get shiftKey() : Boolean
+ {
+ return this.m_shiftKey;
+ }
+
+ public function set shiftKey(value:Boolean) : void
+ {
+ this.m_shiftKey = value;
+ }
+
+ public function get stageX() : Number
+ {
+ if(isNaN(this.localX) || isNaN(this.localY))
+ {
+ return Number.NaN;
+ }
+ return this.getStageX();
+ }
+
+ public function get stageY() : Number
+ {
+ if(isNaN(this.localX) || isNaN(this.localY))
+ {
+ return Number.NaN;
+ }
+ return this.getStageY();
+ }
+
+ public function updateAfterEvent() : void{}
+
+ private function getStageX() : Number{return 0}
+
+ private function getStageY() : Number{return 0}
+
+ public function get isRelatedObjectInaccessible() : Boolean
+ {
+ return this.m_isRelatedObjectInaccessible;
+ }
+
+ public function set isRelatedObjectInaccessible(value:Boolean) : void
+ {
+ this.m_isRelatedObjectInaccessible = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/events/VideoTextureEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/events/VideoTextureEvent.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/VideoTextureEvent.as
new file mode 100644
index 0000000..b1af5a0
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/events/VideoTextureEvent.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.events
+{
+ public class VideoTextureEvent extends Event
+ {
+
+ public static const RENDER_STATE:String = "renderState";
+
+ private var m_status:String;
+
+ private var m_colorSpace:String;
+
+ public var codecInfo:String;
+
+ public function VideoTextureEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, status:String = null, colorSpace:String = null)
+ {
+ super(type,bubbles,cancelable);
+ this.m_status = status;
+ this.m_colorSpace = colorSpace;
+ }
+ public function get status() : String
+ {
+ return this.m_status;
+ }
+ public function get colorSpace() : String
+ {
+ return this.m_colorSpace;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/filters/BitmapFilter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/filters/BitmapFilter.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/filters/BitmapFilter.as
new file mode 100644
index 0000000..b7dfcf1
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/filters/BitmapFilter.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.filters
+{
+ public class BitmapFilter extends Object
+ {
+
+ public function BitmapFilter()
+ {
+ super();
+ }
+
+ public function clone() : BitmapFilter
+ {
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/ColorTransform.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/ColorTransform.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/ColorTransform.as
new file mode 100644
index 0000000..4d2efa8
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/ColorTransform.as
@@ -0,0 +1,133 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.geom
+{
+
+ public class ColorTransform extends Object
+ {
+
+ private var _redMultiplier:Number;
+
+ private var _greenMultiplier:Number;
+
+ private var _blueMultiplier:Number;
+
+ private var _alphaMultiplier:Number;
+
+ public var redOffset:Number;
+
+ public var greenOffset:Number;
+
+ public var blueOffset:Number;
+
+ public var alphaOffset:Number;
+
+ public var tint:uint = 0xffffffff;
+ public function ColorTransform(redMultiplier:Number = 1.0, greenMultiplier:Number = 1.0, blueMultiplier:Number = 1.0, alphaMultiplier:Number = 1.0, redOffset:Number = 0, greenOffset:Number = 0, blueOffset:Number = 0, alphaOffset:Number = 0)
+ {
+ super();
+ this.redMultiplier = redMultiplier;
+ this.greenMultiplier = greenMultiplier;
+ this.blueMultiplier = blueMultiplier;
+ this.alphaMultiplier = alphaMultiplier;
+ this.redOffset = redOffset;
+ this.greenOffset = greenOffset;
+ this.blueOffset = blueOffset;
+ this.alphaOffset = alphaOffset;
+ }
+
+ public function get color():uint
+ {
+ return this.redOffset << 16 | this.greenOffset << 8 | this.blueOffset;
+ }
+
+ public function set color(newColor:uint):void
+ {
+ this.redMultiplier = this.greenMultiplier = this.blueMultiplier = 0;
+ this.redOffset = newColor >> 16 & 255;
+ this.greenOffset = newColor >> 8 & 255;
+ this.blueOffset = newColor & 255;
+ }
+
+ public function get redMultiplier():Number
+ {
+ return _redMultiplier;
+ }
+
+ public function set redMultiplier(value:Number):void
+ {
+ _redMultiplier = value;
+ tint = ((_redMultiplier*0xff) << 0)|((_greenMultiplier*0xff) << 8)|((_blueMultiplier*0xff) << 16) | ((_alphaMultiplier*0xff) << 24);
+ //_glColorArr[0] = value;
+ }
+
+ public function get greenMultiplier():Number
+ {
+ return _greenMultiplier;
+ }
+
+ public function set greenMultiplier(value:Number):void
+ {
+ _greenMultiplier = value;
+ //_glColorArr[1] = value;
+ tint = ((_redMultiplier*0xff) << 0)|((_greenMultiplier*0xff) << 8)|((_blueMultiplier*0xff) << 16) | ((_alphaMultiplier*0xff) << 24);
+ }
+
+ public function get blueMultiplier():Number
+ {
+ return _blueMultiplier;
+ }
+
+ public function set blueMultiplier(value:Number):void
+ {
+ _blueMultiplier = value;
+ //_glColorArr[2] = value;
+ tint = ((_redMultiplier*0xff) << 0)|((_greenMultiplier*0xff) << 8)|((_blueMultiplier*0xff) << 16) | ((_alphaMultiplier*0xff) << 24);
+ }
+
+ public function get alphaMultiplier():Number
+ {
+ return _alphaMultiplier;
+ }
+
+ public function set alphaMultiplier(value:Number):void
+ {
+ _alphaMultiplier = value;
+ //_glColorArr[3] = value;
+ tint = ((_redMultiplier*0xff) << 0)|((_greenMultiplier*0xff) << 8)|((_blueMultiplier*0xff) << 16) | ((_alphaMultiplier*0xff) << 24);
+ }
+
+ public function concat(second:ColorTransform):void
+ {
+ this.alphaOffset = this.alphaOffset + this.alphaMultiplier * second.alphaOffset;
+ this.alphaMultiplier = this.alphaMultiplier * second.alphaMultiplier;
+ this.redOffset = this.redOffset + this.redMultiplier * second.redOffset;
+ this.redMultiplier = this.redMultiplier * second.redMultiplier;
+ this.greenOffset = this.greenOffset + this.greenMultiplier * second.greenOffset;
+ this.greenMultiplier = this.greenMultiplier * second.greenMultiplier;
+ this.blueOffset = this.blueOffset + this.blueMultiplier * second.blueOffset;
+ this.blueMultiplier = this.blueMultiplier * second.blueMultiplier;
+ }
+
+ public function toString():String
+ {
+ return "(redMultiplier=" + this.redMultiplier + ", greenMultiplier=" + this.greenMultiplier + ", blueMultiplier=" + this.blueMultiplier + ", alphaMultiplier=" + this.alphaMultiplier + ", redOffset=" + this.redOffset + ", greenOffset=" + this.greenOffset + ", blueOffset=" + this.blueOffset + ", alphaOffset=" + this.alphaOffset + ")";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/FMatrix.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/FMatrix.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/FMatrix.as
new file mode 100644
index 0000000..3e73c46
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/FMatrix.as
@@ -0,0 +1,276 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.geom
+{
+ /**
+ * ...
+ * @author lizhi
+ */
+ public class FMatrix
+ {
+ public var f:Float32Array = new Float32Array(6);
+ private var t0:Number;
+ private var t1:Number;
+ private var t2:Number;
+ private var t3:Number;
+ public function FMatrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0)
+ {
+ super();
+ f[0] = a;
+ f[1] = b;
+ f[2] = c;
+ f[3] = d;
+ f[4] = tx;
+ f[5] = ty;
+ }
+
+ public function clone():Matrix
+ {
+ return new Matrix(f[0], f[1], f[2], f[3], f[4], f[5]);
+ }
+
+ public function concat(m:FMatrix):void
+ {
+ var f2:Float32Array = m.f;
+ t0 = f[0];
+ f[0] = f[0] * m.a + f[1] * m.c;
+ f[1] = t0 * m.b + f[1] * m.d;
+
+ t0 = f[2];
+ f[2] = f[2] * m.a + f[3] * m.c;
+ f[3] = t0 * m.b + f[3] * m.d;
+
+ t0 = tx;
+ f[4] = tx * m.a + ty * m.c + m.tx;
+ f[5] = t0 * m.b + ty * m.d + m.ty;
+ }
+
+ public function invert():void
+ {
+ if (b === 0 && c === 0)
+ {
+ a = 1 / a;
+ d = 1 / d;
+ tx *= -a;
+ ty *= -d;
+ }
+ else
+ {
+ var det:Number = a * d - b * c;
+ if (det === 0)
+ {
+ a = d = 1;
+ b = c = 0;
+ tx = ty = 0;
+ }else{
+ det = 1 / det;
+ t0 = a;
+ t1 = b;
+ t2 = c;
+ t3 = d;
+ a = t3 * det;
+ b = -t1 * det;
+ c = -t2 * det;
+ d = t0 * det;
+ t0 = -(b * tx + d * ty);
+ tx = -(a * tx + c * ty);
+ ty = t0;
+ }
+ }
+ }
+
+ public function identity():void
+ {
+ a = d = 1;
+ b = c = 0;
+ tx = ty = 0;
+ }
+
+ public function createBox(scaleX:Number, scaleY:Number, rotation:Number = 0, tx:Number = 0, ty:Number = 0):void
+ {
+ var u:Number = Math.cos(rotation);
+ var v:Number = Math.sin(rotation);
+ a = u * scaleX;
+ b = v * scaleY;
+ c = -v * scaleX;
+ d = u * scaleY;
+ tx = tx;
+ ty = ty;
+ }
+
+ public function createGradientBox(width:Number, height:Number, rotation:Number = 0, tx:Number = 0, ty:Number = 0):void
+ {
+ this.createBox(width / 1638.4, height / 1638.4, rotation, tx + width / 2, ty + height / 2);
+ }
+
+ public function rotate(angle:Number):void
+ {
+ var u:Number = Math.cos(angle);
+ var v:Number = Math.sin(angle);
+ t0 = a;
+ t1 = c;
+ t2 = tx;
+ a = u * a - v * b;
+ b = v * t0 + u * b;
+ c = u * c - v * d;
+ d = v * t1 + u * d;
+ tx = u * tx - v * ty;
+ ty = v * t2 + u * ty;
+ }
+
+ public function translate(dx:Number, dy:Number):void
+ {
+ tx += dx;
+ ty += dy;
+ }
+
+ public function scale(sx:Number, sy:Number):void
+ {
+ a *= sx;
+ b *= sy;
+ c *= sx;
+ d *= sy;
+ tx *= sx;
+ ty *= sy;
+ }
+
+ public function deltaTransformPoint(point:Point):Point
+ {
+ return new Point(a * point.x + c * point.y, d * point.y + b * point.x);
+ }
+
+ public function transformPoint(point:Point):Point
+ {
+ return new Point(a * point.x + c * point.y + tx, d * point.y + b * point.x + ty);
+ }
+
+ public function toString():String
+ {
+ return "(a=" + a + ", b=" + b + ", c=" + c + ", d=" + d + ", tx=" + tx + ", ty=" + ty + ")";
+ }
+
+ public function copyFrom(sourceMatrix:Matrix):void
+ {
+ a = sourceMatrix.a;
+ b = sourceMatrix.b;
+ c = sourceMatrix.c;
+ d = sourceMatrix.d;
+ tx = sourceMatrix.tx;
+ ty = sourceMatrix.ty;
+ }
+
+ public function setTo(aa:Number, ba:Number, ca:Number, da:Number, txa:Number, tya:Number):void
+ {
+ a = aa;
+ b = ba;
+ c = ca;
+ d = da;
+ tx = txa;
+ ty = tya;
+ }
+
+ public function copyRowTo(row:uint, vector3D:Vector3D):void
+ {
+ switch (row)
+ {
+ case 0:
+ break;
+ case 1:
+ vector3D.x = b;
+ vector3D.y = d;
+ vector3D.z = ty;
+ break;
+ case 2:
+ case 3:
+ vector3D.x = 0;
+ vector3D.y = 0;
+ vector3D.z = 1;
+ break;
+ default:
+ vector3D.x = a;
+ vector3D.y = c;
+ vector3D.z = tx;
+ }
+ }
+
+ public function copyColumnTo(column:uint, vector3D:Vector3D):void
+ {
+ switch (column)
+ {
+ case 0:
+ break;
+ case 1:
+ vector3D.x = c;
+ vector3D.y = d;
+ vector3D.z = 0;
+ break;
+ case 2:
+ case 3:
+ vector3D.x = tx;
+ vector3D.y = ty;
+ vector3D.z = 1;
+ break;
+ default:
+ vector3D.x = a;
+ vector3D.y = b;
+ vector3D.z = 0;
+ }
+ }
+
+ public function copyRowFrom(row:uint, vector3D:Vector3D):void
+ {
+ switch (row)
+ {
+ case 0:
+ break;
+ case 1:
+ case 2:
+ b = vector3D.x;
+ d = vector3D.y;
+ ty = vector3D.z;
+ break;
+ default:
+ a = vector3D.x;
+ c = vector3D.y;
+ tx = vector3D.z;
+ }
+ }
+
+ public function copyColumnFrom(column:uint, vector3D:Vector3D):void
+ {
+ switch (column)
+ {
+ case 0:
+ break;
+ case 1:
+ case 2:
+ b = vector3D.x;
+ d = vector3D.y;
+ ty = vector3D.z;
+ break;
+ default:
+ a = vector3D.x;
+ c = vector3D.y;
+ tx = vector3D.z;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix.as
new file mode 100644
index 0000000..f518979
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix.as
@@ -0,0 +1,276 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.geom
+{
+
+ public class Matrix
+ {
+
+ public var a:Number;
+ public var b:Number;
+ public var c:Number;
+ public var d:Number;
+ public var tx:Number;
+ public var ty:Number;
+ private var t0:Number;
+ private var t1:Number;
+ private var t2:Number;
+ private var t3:Number;
+ public function Matrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0)
+ {
+ super();
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ this.d = d;
+ this.tx = tx;
+ this.ty = ty;
+ }
+
+ public function clone():Matrix
+ {
+ return new Matrix(a, b, c, d, tx, ty);
+ }
+
+ public function concat(m:Matrix):void
+ {
+ t0 = a;
+ a = a * m.a + b * m.c;
+ b = t0 * m.b + b * m.d;
+
+ t0 = c;
+ c = c * m.a + d * m.c;
+ d = t0 * m.b + d * m.d;
+
+ t0 = tx;
+ tx = tx * m.a + ty * m.c + m.tx;
+ ty = t0 * m.b + ty * m.d + m.ty;
+ }
+
+ public function invert():void
+ {
+ if (b === 0 && c === 0)
+ {
+ a = 1 / a;
+ d = 1 / d;
+ tx *= -a;
+ ty *= -d;
+ }
+ else
+ {
+ var det:Number = a * d - b * c;
+ if (det === 0)
+ {
+ a = d = 1;
+ b = c = 0;
+ tx = ty = 0;
+ }else{
+ det = 1 / det;
+ t0 = a;
+ t1 = b;
+ t2 = c;
+ t3 = d;
+ a = t3 * det;
+ b = -t1 * det;
+ c = -t2 * det;
+ d = t0 * det;
+ t0 = -(b * tx + d * ty);
+ tx = -(a * tx + c * ty);
+ ty = t0;
+ }
+ }
+ }
+
+ public function identity():void
+ {
+ a = d = 1;
+ b = c = 0;
+ tx = ty = 0;
+ }
+
+ public function createBox(scaleX:Number, scaleY:Number, rotation:Number = 0, tx:Number = 0, ty:Number = 0):void
+ {
+ var u:Number = Math.cos(rotation);
+ var v:Number = Math.sin(rotation);
+ a = u * scaleX;
+ b = v * scaleY;
+ c = -v * scaleX;
+ d = u * scaleY;
+ tx = tx;
+ ty = ty;
+ }
+
+ public function createGradientBox(width:Number, height:Number, rotation:Number = 0, tx:Number = 0, ty:Number = 0):void
+ {
+ this.createBox(width / 1638.4, height / 1638.4, rotation, tx + width / 2, ty + height / 2);
+ }
+
+ public function rotate(angle:Number):void
+ {
+ var u:Number = Math.cos(angle);
+ var v:Number = Math.sin(angle);
+ t0 = a;
+ t1 = c;
+ t2 = tx;
+ a = u * a - v * b;
+ b = v * t0 + u * b;
+ c = u * c - v * d;
+ d = v * t1 + u * d;
+ tx = u * tx - v * ty;
+ ty = v * t2 + u * ty;
+ }
+
+ public function translate(dx:Number, dy:Number):void
+ {
+ tx += dx;
+ ty += dy;
+ }
+
+ public function scale(sx:Number, sy:Number):void
+ {
+ a *= sx;
+ b *= sy;
+ c *= sx;
+ d *= sy;
+ tx *= sx;
+ ty *= sy;
+ }
+
+ public function deltaTransformPoint(point:Point):Point
+ {
+ return new Point(a * point.x + c * point.y, d * point.y + b * point.x);
+ }
+
+ public function transformPoint(point:Point):Point
+ {
+ return new Point(a * point.x + c * point.y + tx, d * point.y + b * point.x + ty);
+ }
+
+ public function toString():String
+ {
+ return "(a=" + a + ", b=" + b + ", c=" + c + ", d=" + d + ", tx=" + tx + ", ty=" + ty + ")";
+ }
+
+ public function copyFrom(sourceMatrix:Matrix):void
+ {
+ a = sourceMatrix.a;
+ b = sourceMatrix.b;
+ c = sourceMatrix.c;
+ d = sourceMatrix.d;
+ tx = sourceMatrix.tx;
+ ty = sourceMatrix.ty;
+ }
+
+ public function setTo(aa:Number, ba:Number, ca:Number, da:Number, txa:Number, tya:Number):void
+ {
+ a = aa;
+ b = ba;
+ c = ca;
+ d = da;
+ tx = txa;
+ ty = tya;
+ }
+
+ public function copyRowTo(row:uint, vector3D:Vector3D):void
+ {
+ switch (row)
+ {
+ case 0:
+ break;
+ case 1:
+ vector3D.x = b;
+ vector3D.y = d;
+ vector3D.z = ty;
+ break;
+ case 2:
+ case 3:
+ vector3D.x = 0;
+ vector3D.y = 0;
+ vector3D.z = 1;
+ break;
+ default:
+ vector3D.x = a;
+ vector3D.y = c;
+ vector3D.z = tx;
+ }
+ }
+
+ public function copyColumnTo(column:uint, vector3D:Vector3D):void
+ {
+ switch (column)
+ {
+ case 0:
+ break;
+ case 1:
+ vector3D.x = c;
+ vector3D.y = d;
+ vector3D.z = 0;
+ break;
+ case 2:
+ case 3:
+ vector3D.x = tx;
+ vector3D.y = ty;
+ vector3D.z = 1;
+ break;
+ default:
+ vector3D.x = a;
+ vector3D.y = b;
+ vector3D.z = 0;
+ }
+ }
+
+ public function copyRowFrom(row:uint, vector3D:Vector3D):void
+ {
+ switch (row)
+ {
+ case 0:
+ break;
+ case 1:
+ case 2:
+ b = vector3D.x;
+ d = vector3D.y;
+ ty = vector3D.z;
+ break;
+ default:
+ a = vector3D.x;
+ c = vector3D.y;
+ tx = vector3D.z;
+ }
+ }
+
+ public function copyColumnFrom(column:uint, vector3D:Vector3D):void
+ {
+ switch (column)
+ {
+ case 0:
+ break;
+ case 1:
+ case 2:
+ b = vector3D.x;
+ d = vector3D.y;
+ ty = vector3D.z;
+ break;
+ default:
+ a = vector3D.x;
+ c = vector3D.y;
+ tx = vector3D.z;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix3D.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix3D.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix3D.as
new file mode 100644
index 0000000..d392d6d
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Matrix3D.as
@@ -0,0 +1,645 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.geom{
+ import flash.geom.Orientation3D;
+ import flash.geom.Vector3D;
+ public class Matrix3D {
+ private static var TEMP:Matrix3D = new Matrix3D;
+ public function Matrix3D(v : Vector.<Number> = null) : void {
+ if(v != null && v.length === 16) this.rawData = v;
+ else this.rawData = Vector.<Number>([1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0]);
+ }
+
+ public function get determinant() : Number {
+ return (this.rawData[0] * this.rawData[5] - this.rawData[4] * this.rawData[1]) * (this.rawData[10] * this.rawData[15] - this.rawData[14] * this.rawData[11]) - (this.rawData[0] * this.rawData[9] - this.rawData[8] * this.rawData[1]) * (this.rawData[6] * this.rawData[15] - this.rawData[14] * this.rawData[7]) + (this.rawData[0] * this.rawData[13] - this.rawData[12] * this.rawData[1]) * (this.rawData[6] * this.rawData[11] - this.rawData[10] * this.rawData[7]) + (this.rawData[4] * this.rawData[9] - this.rawData[8] * this.rawData[5]) * (this.rawData[2] * this.rawData[15] - this.rawData[14] * this.rawData[3]) - (this.rawData[4] * this.rawData[13] - this.rawData[12] * this.rawData[5]) * (this.rawData[2] * this.rawData[11] - this.rawData[10] * this.rawData[3]) + (this.rawData[8] * this.rawData[13] - this.rawData[12] * this.rawData[9]) * (this.rawData[2] * this.rawData[7] - this.rawData[6] * this.rawData[3]);
+ }
+ public function get position() : flash.geom.Vector3D {return new flash.geom.Vector3D(this.rawData[12],this.rawData[13],this.rawData[14])}
+ public function set position( val : flash.geom.Vector3D ) : void {
+ this.rawData[12] = val.x;
+ this.rawData[13] = val.y;
+ this.rawData[14] = val.z;
+ }
+ public var rawData : Vector.<Number>;
+ public function append(lhs : Matrix3D) : void {
+ var m111 : Number = this.rawData[0] as Number;
+ var m121 : Number = this.rawData[4] as Number;
+ var m131 : Number = this.rawData[8] as Number;
+ var m141 : Number = this.rawData[12] as Number;
+ var m112 : Number = this.rawData[1] as Number;
+ var m122 : Number = this.rawData[5] as Number;
+ var m132 : Number = this.rawData[9] as Number;
+ var m142 : Number = this.rawData[13] as Number;
+ var m113 : Number = this.rawData[2] as Number;
+ var m123 : Number = this.rawData[6] as Number;
+ var m133 : Number = this.rawData[10] as Number;
+ var m143 : Number = this.rawData[14] as Number;
+ var m114 : Number = this.rawData[3] as Number;
+ var m124 : Number = this.rawData[7] as Number;
+ var m134 : Number = this.rawData[11] as Number;
+ var m144 : Number = this.rawData[15] as Number;
+ var m211 : Number = lhs.rawData[0] as Number;
+ var m221 : Number = lhs.rawData[4] as Number;
+ var m231 : Number = lhs.rawData[8] as Number;
+ var m241 : Number = lhs.rawData[12] as Number;
+ var m212 : Number = lhs.rawData[1] as Number;
+ var m222 : Number = lhs.rawData[5] as Number;
+ var m232 : Number = lhs.rawData[9] as Number;
+ var m242 : Number = lhs.rawData[13] as Number;
+ var m213 : Number = lhs.rawData[2] as Number;
+ var m223 : Number = lhs.rawData[6] as Number;
+ var m233 : Number = lhs.rawData[10] as Number;
+ var m243 : Number = lhs.rawData[14] as Number;
+ var m214 : Number = lhs.rawData[3] as Number;
+ var m224 : Number = lhs.rawData[7] as Number;
+ var m234 : Number = lhs.rawData[11] as Number;
+ var m244 : Number = lhs.rawData[15] as Number;
+ this.rawData[0] = m111 * m211 + m112 * m221 + m113 * m231 + m114 * m241;
+ this.rawData[1] = m111 * m212 + m112 * m222 + m113 * m232 + m114 * m242;
+ this.rawData[2] = m111 * m213 + m112 * m223 + m113 * m233 + m114 * m243;
+ this.rawData[3] = m111 * m214 + m112 * m224 + m113 * m234 + m114 * m244;
+ this.rawData[4] = m121 * m211 + m122 * m221 + m123 * m231 + m124 * m241;
+ this.rawData[5] = m121 * m212 + m122 * m222 + m123 * m232 + m124 * m242;
+ this.rawData[6] = m121 * m213 + m122 * m223 + m123 * m233 + m124 * m243;
+ this.rawData[7] = m121 * m214 + m122 * m224 + m123 * m234 + m124 * m244;
+ this.rawData[8] = m131 * m211 + m132 * m221 + m133 * m231 + m134 * m241;
+ this.rawData[9] = m131 * m212 + m132 * m222 + m133 * m232 + m134 * m242;
+ this.rawData[10] = m131 * m213 + m132 * m223 + m133 * m233 + m134 * m243;
+ this.rawData[11] = m131 * m214 + m132 * m224 + m133 * m234 + m134 * m244;
+ this.rawData[12] = m141 * m211 + m142 * m221 + m143 * m231 + m144 * m241;
+ this.rawData[13] = m141 * m212 + m142 * m222 + m143 * m232 + m144 * m242;
+ this.rawData[14] = m141 * m213 + m142 * m223 + m143 * m233 + m144 * m243;
+ this.rawData[15] = m141 * m214 + m142 * m224 + m143 * m234 + m144 * m244;
+ }
+
+ public function appendRotation(degrees : Number,axis : flash.geom.Vector3D,pivotPoint : flash.geom.Vector3D = null) : void {
+ var m : Matrix3D = Matrix3D.getAxisRotation(axis.x,axis.y,axis.z,degrees);
+ if(pivotPoint != null) {
+ var p : flash.geom.Vector3D = pivotPoint;
+ m.appendTranslation(p.x,p.y,p.z);
+ };
+ this.append(m);
+ }
+
+ public function appendScale(xScale : Number, yScale : Number, zScale : Number) : void {
+ this.rawData[0] *= xScale; this.rawData[1] *= xScale; this.rawData[2] *= xScale; this.rawData[3] *= xScale;
+ this.rawData[4] *= yScale; this.rawData[5] *= yScale; this.rawData[6] *= yScale; this.rawData[7] *= yScale;
+ this.rawData[8] *= zScale; this.rawData[9] *= zScale; this.rawData[10] *= zScale; this.rawData[11] *= zScale;
+ //this.append(new Matrix3D(Vector.<Number>([xScale,0.0,0.0,0.0,0.0,yScale,0.0,0.0,0.0,0.0,zScale,0.0,0.0,0.0,0.0,1.0])));
+ }
+
+ public function appendTranslation(x : Number,y : Number,z : Number) : void {
+ this.rawData[12] += x;
+ this.rawData[13] += y;
+ this.rawData[14] += z;
+ }
+
+ public function clone() : Matrix3D {
+ return new Matrix3D(this.rawData.concat());
+ }
+
+ public function copyColumnFrom(column : int,vector3D : flash.geom.Vector3D) : void {
+ switch(column) {
+ case 0:
+ {
+ this.rawData[0] = vector3D.x;
+ this.rawData[1] = vector3D.y;
+ this.rawData[2] = vector3D.z;
+ this.rawData[3] = vector3D.w;
+ }
+ break;
+ case 1:
+ {
+ this.rawData[4] = vector3D.x;
+ this.rawData[5] = vector3D.y;
+ this.rawData[6] = vector3D.z;
+ this.rawData[7] = vector3D.w;
+ }
+ break;
+ case 2:
+ {
+ this.rawData[8] = vector3D.x;
+ this.rawData[9] = vector3D.y;
+ this.rawData[10] = vector3D.z;
+ this.rawData[11] = vector3D.w;
+ }
+ break;
+ case 3:
+ {
+ this.rawData[12] = vector3D.x;
+ this.rawData[13] = vector3D.y;
+ this.rawData[14] = vector3D.z;
+ this.rawData[15] = vector3D.w;
+ }
+ break;
+ default:
+ throw new Error("Error, Column " + column + " out of bounds [0, ..., 3]");
+ break;
+ }
+ }
+
+ public function copyColumnTo(column : int,vector3D : flash.geom.Vector3D) : void {
+ var c4:int = column * 4;
+ vector3D.x = this.rawData[c4] as Number;
+ vector3D.y = this.rawData[1+c4] as Number;
+ vector3D.z = this.rawData[2+c4] as Number;
+ vector3D.w = this.rawData[3+c4] as Number;
+ }
+
+ public function copyFrom(other : Matrix3D) : void {
+ this.rawData = other.rawData.concat();
+ }
+
+ public function copyRawDataFrom(vector : Vector.<Number>,index : uint = 0,transpose : Boolean = false) : void {
+ if(transpose) this.transpose();
+ var l : uint = vector.length - index;
+ {
+ var _g : int = 0;
+ while(_g < int(l)) {
+ var c : int = _g++;
+ this.rawData[c] = vector[c + index];
+ }
+ };
+ if(transpose) this.transpose();
+ }
+
+ public function copyRawDataTo(vector : Vector.<Number>,index : uint = 0,transpose : Boolean = false) : void {
+ if(transpose) this.transpose();
+ var l : uint = this.rawData.length as Number;
+ {
+ var _g : int = 0;
+ while(_g < l) {
+ var c : int = _g++;
+ vector[c + index] = this.rawData[c];
+ }
+ };
+ if(transpose) this.transpose();
+ }
+
+ public function copyRowFrom(row : uint,vector3D : flash.geom.Vector3D) : void {
+ switch(row) {
+ case 0:
+ {
+ this.rawData[0] = vector3D.x;
+ this.rawData[4] = vector3D.y;
+ this.rawData[8] = vector3D.z;
+ this.rawData[12] = vector3D.w;
+ }
+ break;
+ case 1:
+ {
+ this.rawData[1] = vector3D.x;
+ this.rawData[5] = vector3D.y;
+ this.rawData[9] = vector3D.z;
+ this.rawData[13] = vector3D.w;
+ }
+ break;
+ case 2:
+ {
+ this.rawData[2] = vector3D.x;
+ this.rawData[6] = vector3D.y;
+ this.rawData[10] = vector3D.z;
+ this.rawData[14] = vector3D.w;
+ }
+ break;
+ case 3:
+ {
+ this.rawData[3] = vector3D.x;
+ this.rawData[7] = vector3D.y;
+ this.rawData[11] = vector3D.z;
+ this.rawData[15] = vector3D.w;
+ }
+ break;
+ default:
+ throw new Error("Error, Row " + ("" + row) + " out of bounds [0, ..., 3]");
+ break;
+ }
+ }
+
+ public function copyRowTo(row : int,vector3D : flash.geom.Vector3D) : void {
+ vector3D.x = this.rawData[row] as Number;
+ vector3D.y = this.rawData[4+row] as Number;
+ vector3D.z = this.rawData[8+row] as Number;
+ vector3D.w = this.rawData[12+row] as Number;
+ }
+
+ public function copyToMatrix3D(other : Matrix3D) : void {
+ other.rawData = this.rawData.concat();
+ }
+
+ public function decompose(orientationStyle : String = null) : Vector.<flash.geom.Vector3D> {
+ if(orientationStyle == null) orientationStyle = flash.geom.Orientation3D.EULER_ANGLES;
+ var vec : Vector.<flash.geom.Vector3D> = new Vector.<flash.geom.Vector3D>();
+ var m : Matrix3D = this.clone();
+ var mr : Vector.<Number> = m.rawData.concat();
+ var pos : flash.geom.Vector3D = new flash.geom.Vector3D(mr[12],mr[13],mr[14]);
+ var scale : flash.geom.Vector3D = new flash.geom.Vector3D();
+ scale.x = Math.sqrt(mr[0] * mr[0] + mr[1] * mr[1] + mr[2] * mr[2]);
+ scale.y = Math.sqrt(mr[4] * mr[4] + mr[5] * mr[5] + mr[6] * mr[6]);
+ scale.z = Math.sqrt(mr[8] * mr[8] + mr[9] * mr[9] + mr[10] * mr[10]);
+ if(mr[0] * (mr[5] * mr[10] - mr[6] * mr[9]) - mr[1] * (mr[4] * mr[10] - mr[6] * mr[8]) + mr[2] * (mr[4] * mr[9] - mr[5] * mr[8]) < 0) scale.z = -scale.z;
+ mr[0] /= scale.x;
+ mr[1] /= scale.x;
+ mr[2] /= scale.x;
+ mr[4] /= scale.y;
+ mr[5] /= scale.y;
+ mr[6] /= scale.y;
+ mr[8] /= scale.z;
+ mr[9] /= scale.z;
+ mr[10] /= scale.z;
+ var rot : flash.geom.Vector3D = new flash.geom.Vector3D();
+ switch(orientationStyle) {
+ case flash.geom.Orientation3D.AXIS_ANGLE:
+ {
+ rot.w = Math.acos((mr[0] + mr[5] + mr[10] - 1) / 2);
+ var len : Number = Math.sqrt((mr[6] - mr[9]) * (mr[6] - mr[9]) + (mr[8] - mr[2]) * (mr[8] - mr[2]) + (mr[1] - mr[4]) * (mr[1] - mr[4]));
+ if(len != 0) {
+ rot.x = (mr[6] - mr[9]) / len;
+ rot.y = (mr[8] - mr[2]) / len;
+ rot.z = (mr[1] - mr[4]) / len;
+ }
+ else rot.x = rot.y = rot.z = 0;
+ }
+ break;
+ case flash.geom.Orientation3D.QUATERNION:
+ {
+ var tr : Number = (mr[0] + mr[5] + mr[10]) as Number;
+ if(tr > 0) {
+ rot.w = Math.sqrt(1 + tr) / 2;
+ rot.x = (mr[6] - mr[9]) / (4 * rot.w);
+ rot.y = (mr[8] - mr[2]) / (4 * rot.w);
+ rot.z = (mr[1] - mr[4]) / (4 * rot.w);
+ }
+ else if(mr[0] > mr[5] && mr[0] > mr[10]) {
+ rot.x = Math.sqrt(1 + mr[0] - mr[5] - mr[10]) / 2;
+ rot.w = (mr[6] - mr[9]) / (4 * rot.x);
+ rot.y = (mr[1] + mr[4]) / (4 * rot.x);
+ rot.z = (mr[8] + mr[2]) / (4 * rot.x);
+ }
+ else if(mr[5] > mr[10]) {
+ rot.y = Math.sqrt(1 + mr[5] - mr[0] - mr[10]) / 2;
+ rot.x = (mr[1] + mr[4]) / (4 * rot.y);
+ rot.w = (mr[8] - mr[2]) / (4 * rot.y);
+ rot.z = (mr[6] + mr[9]) / (4 * rot.y);
+ }
+ else {
+ rot.z = Math.sqrt(1 + mr[10] - mr[0] - mr[5]) / 2;
+ rot.x = (mr[8] + mr[2]) / (4 * rot.z);
+ rot.y = (mr[6] + mr[9]) / (4 * rot.z);
+ rot.w = (mr[1] - mr[4]) / (4 * rot.z);
+ }
+ }
+ break;
+ case flash.geom.Orientation3D.EULER_ANGLES:
+ {
+ rot.y = Math.asin(-mr[2]);
+ if(mr[2] != 1 && mr[2] != -1) {
+ rot.x = Math.atan2(mr[6],mr[10]);
+ rot.z = Math.atan2(mr[1],mr[0]);
+ }
+ else {
+ rot.z = 0;
+ rot.x = Math.atan2(mr[4],mr[5]);
+ }
+ }
+ break;
+ };
+ vec.push(pos);
+ vec.push(rot);
+ vec.push(scale);
+ return vec;
+ }
+
+ public function deltaTransformVector(v : flash.geom.Vector3D) : flash.geom.Vector3D {
+ var x : Number = v.x;
+ var y : Number = v.y;
+ var z : Number = v.z;
+ return new flash.geom.Vector3D(x * this.rawData[0] + y * this.rawData[4] + z * this.rawData[8] + this.rawData[3],x * this.rawData[1] + y * this.rawData[5] + z * this.rawData[9] + this.rawData[7],x * this.rawData[2] + y * this.rawData[6] + z * this.rawData[10] + this.rawData[11],0);
+ }
+
+ public function identity() : void {
+ rawData[0] = 1;rawData[1] = 0;rawData[2] = 0;rawData[3] = 0;
+ rawData[4] = 0;rawData[5] = 1;rawData[6] = 0;rawData[7] = 0;
+ rawData[8] = 0;rawData[9] = 0;rawData[10] = 1;rawData[11] = 0;
+ rawData[12] = 0;rawData[13] = 0;rawData[14] = 0;rawData[15] = 1;
+ }
+
+ public function interpolateTo(toMat : Matrix3D,percent : Number) : void {
+ var _g : int = 0;
+ while(_g < 16) {
+ var i : int = _g++;
+ this.rawData[i] = this.rawData[i] + (toMat.rawData[i] - this.rawData[i]) * percent;
+ }
+ }
+
+ public function invert() : Boolean {
+ var d : Number = this.determinant;
+ var invertable : Boolean = Math.abs(d) > 0.00000000001;
+ if(invertable) {
+ d = 1 / d;
+ var m11 : Number = this.rawData[0] as Number;
+ var m21 : Number = this.rawData[4] as Number;
+ var m31 : Number = this.rawData[8] as Number;
+ var m41 : Number = this.rawData[12] as Number;
+ var m12 : Number = this.rawData[1] as Number;
+ var m22 : Number = this.rawData[5] as Number;
+ var m32 : Number = this.rawData[9] as Number;
+ var m42 : Number = this.rawData[13] as Number;
+ var m13 : Number = this.rawData[2] as Number;
+ var m23 : Number = this.rawData[6] as Number;
+ var m33 : Number = this.rawData[10] as Number;
+ var m43 : Number = this.rawData[14] as Number;
+ var m14 : Number = this.rawData[3] as Number;
+ var m24 : Number = this.rawData[7] as Number;
+ var m34 : Number = this.rawData[11] as Number;
+ var m44 : Number = this.rawData[15] as Number;
+ this.rawData[0] = d * (m22 * (m33 * m44 - m43 * m34) - m32 * (m23 * m44 - m43 * m24) + m42 * (m23 * m34 - m33 * m24));
+ this.rawData[1] = -d * (m12 * (m33 * m44 - m43 * m34) - m32 * (m13 * m44 - m43 * m14) + m42 * (m13 * m34 - m33 * m14));
+ this.rawData[2] = d * (m12 * (m23 * m44 - m43 * m24) - m22 * (m13 * m44 - m43 * m14) + m42 * (m13 * m24 - m23 * m14));
+ this.rawData[3] = -d * (m12 * (m23 * m34 - m33 * m24) - m22 * (m13 * m34 - m33 * m14) + m32 * (m13 * m24 - m23 * m14));
+ this.rawData[4] = -d * (m21 * (m33 * m44 - m43 * m34) - m31 * (m23 * m44 - m43 * m24) + m41 * (m23 * m34 - m33 * m24));
+ this.rawData[5] = d * (m11 * (m33 * m44 - m43 * m34) - m31 * (m13 * m44 - m43 * m14) + m41 * (m13 * m34 - m33 * m14));
+ this.rawData[6] = -d * (m11 * (m23 * m44 - m43 * m24) - m21 * (m13 * m44 - m43 * m14) + m41 * (m13 * m24 - m23 * m14));
+ this.rawData[7] = d * (m11 * (m23 * m34 - m33 * m24) - m21 * (m13 * m34 - m33 * m14) + m31 * (m13 * m24 - m23 * m14));
+ this.rawData[8] = d * (m21 * (m32 * m44 - m42 * m34) - m31 * (m22 * m44 - m42 * m24) + m41 * (m22 * m34 - m32 * m24));
+ this.rawData[9] = -d * (m11 * (m32 * m44 - m42 * m34) - m31 * (m12 * m44 - m42 * m14) + m41 * (m12 * m34 - m32 * m14));
+ this.rawData[10] = d * (m11 * (m22 * m44 - m42 * m24) - m21 * (m12 * m44 - m42 * m14) + m41 * (m12 * m24 - m22 * m14));
+ this.rawData[11] = -d * (m11 * (m22 * m34 - m32 * m24) - m21 * (m12 * m34 - m32 * m14) + m31 * (m12 * m24 - m22 * m14));
+ this.rawData[12] = -d * (m21 * (m32 * m43 - m42 * m33) - m31 * (m22 * m43 - m42 * m23) + m41 * (m22 * m33 - m32 * m23));
+ this.rawData[13] = d * (m11 * (m32 * m43 - m42 * m33) - m31 * (m12 * m43 - m42 * m13) + m41 * (m12 * m33 - m32 * m13));
+ this.rawData[14] = -d * (m11 * (m22 * m43 - m42 * m23) - m21 * (m12 * m43 - m42 * m13) + m41 * (m12 * m23 - m22 * m13));
+ this.rawData[15] = d * (m11 * (m22 * m33 - m32 * m23) - m21 * (m12 * m33 - m32 * m13) + m31 * (m12 * m23 - m22 * m13));
+ };
+ return invertable;
+ }
+
+ public function pointAt(pos : flash.geom.Vector3D,at : flash.geom.Vector3D = null,up : flash.geom.Vector3D = null) : void {
+ if(at == null) at = new flash.geom.Vector3D(0,0,-1);
+ if(up == null) up = new flash.geom.Vector3D(0,-1,0);
+ var dir : flash.geom.Vector3D = at.subtract(pos);
+ var vup : flash.geom.Vector3D = up.clone();
+ var right : flash.geom.Vector3D;
+ dir.normalize();
+ vup.normalize();
+ var dir2 : flash.geom.Vector3D = dir.clone();
+ dir2.scaleBy(vup.dotProduct(dir));
+ vup = vup.subtract(dir2);
+ if(vup.length > 0) vup.normalize();
+ else if(dir.x != 0) vup = new flash.geom.Vector3D(-dir.y,dir.x,0);
+ else vup = new flash.geom.Vector3D(1,0,0);
+ right = vup.crossProduct(dir);
+ right.normalize();
+ this.rawData[0] = right.x;
+ this.rawData[4] = right.y;
+ this.rawData[8] = right.z;
+ this.rawData[12] = 0.0;
+ this.rawData[1] = vup.x;
+ this.rawData[5] = vup.y;
+ this.rawData[9] = vup.z;
+ this.rawData[13] = 0.0;
+ this.rawData[2] = dir.x;
+ this.rawData[6] = dir.y;
+ this.rawData[10] = dir.z;
+ this.rawData[14] = 0.0;
+ this.rawData[3] = pos.x;
+ this.rawData[7] = pos.y;
+ this.rawData[11] = pos.z;
+ this.rawData[15] = 1.0;
+ }
+
+ public function prepend(rhs : Matrix3D) : void {
+ var m111 : Number = rhs.rawData[0] as Number;
+ var m121 : Number = rhs.rawData[4] as Number;
+ var m131 : Number = rhs.rawData[8] as Number;
+ var m141 : Number = rhs.rawData[12] as Number;
+ var m112 : Number = rhs.rawData[1] as Number;
+ var m122 : Number = rhs.rawData[5] as Number;
+ var m132 : Number = rhs.rawData[9] as Number;
+ var m142 : Number = rhs.rawData[13] as Number;
+ var m113 : Number = rhs.rawData[2] as Number;
+ var m123 : Number = rhs.rawData[6] as Number;
+ var m133 : Number = rhs.rawData[10] as Number;
+ var m143 : Number = rhs.rawData[14] as Number;
+ var m114 : Number = rhs.rawData[3] as Number;
+ var m124 : Number = rhs.rawData[7] as Number;
+ var m134 : Number = rhs.rawData[11] as Number;
+ var m144 : Number = rhs.rawData[15] as Number;
+ var m211 : Number = this.rawData[0] as Number;
+ var m221 : Number = this.rawData[4] as Number;
+ var m231 : Number = this.rawData[8] as Number;
+ var m241 : Number = this.rawData[12] as Number;
+ var m212 : Number = this.rawData[1] as Number;
+ var m222 : Number = this.rawData[5] as Number;
+ var m232 : Number = this.rawData[9] as Number;
+ var m242 : Number = this.rawData[13] as Number;
+ var m213 : Number = this.rawData[2] as Number;
+ var m223 : Number = this.rawData[6] as Number;
+ var m233 : Number = this.rawData[10] as Number;
+ var m243 : Number = this.rawData[14] as Number;
+ var m214 : Number = this.rawData[3] as Number;
+ var m224 : Number = this.rawData[7] as Number;
+ var m234 : Number = this.rawData[11] as Number;
+ var m244 : Number = this.rawData[15] as Number;
+ this.rawData[0] = m111 * m211 + m112 * m221 + m113 * m231 + m114 * m241;
+ this.rawData[1] = m111 * m212 + m112 * m222 + m113 * m232 + m114 * m242;
+ this.rawData[2] = m111 * m213 + m112 * m223 + m113 * m233 + m114 * m243;
+ this.rawData[3] = m111 * m214 + m112 * m224 + m113 * m234 + m114 * m244;
+ this.rawData[4] = m121 * m211 + m122 * m221 + m123 * m231 + m124 * m241;
+ this.rawData[5] = m121 * m212 + m122 * m222 + m123 * m232 + m124 * m242;
+ this.rawData[6] = m121 * m213 + m122 * m223 + m123 * m233 + m124 * m243;
+ this.rawData[7] = m121 * m214 + m122 * m224 + m123 * m234 + m124 * m244;
+ this.rawData[8] = m131 * m211 + m132 * m221 + m133 * m231 + m134 * m241;
+ this.rawData[9] = m131 * m212 + m132 * m222 + m133 * m232 + m134 * m242;
+ this.rawData[10] = m131 * m213 + m132 * m223 + m133 * m233 + m134 * m243;
+ this.rawData[11] = m131 * m214 + m132 * m224 + m133 * m234 + m134 * m244;
+ this.rawData[12] = m141 * m211 + m142 * m221 + m143 * m231 + m144 * m241;
+ this.rawData[13] = m141 * m212 + m142 * m222 + m143 * m232 + m144 * m242;
+ this.rawData[14] = m141 * m213 + m142 * m223 + m143 * m233 + m144 * m243;
+ this.rawData[15] = m141 * m214 + m142 * m224 + m143 * m234 + m144 * m244;
+ }
+
+ public function prependRotation(degrees : Number,axis : flash.geom.Vector3D,pivotPoint : flash.geom.Vector3D = null) : void {
+ var m : Matrix3D = Matrix3D.getAxisRotation(axis.x,axis.y,axis.z,degrees);
+ if(pivotPoint != null) {
+ var p : flash.geom.Vector3D = pivotPoint;
+ m.appendTranslation(p.x,p.y,p.z);
+ };
+ this.prepend(m);
+ }
+
+ public function prependScale(xScale : Number,yScale : Number,zScale : Number) : void {
+ //this.prepend(new Matrix3D(Vector.<Number>([xScale,0.0,0.0,0.0,0.0,yScale,0.0,0.0,0.0,0.0,zScale,0.0,0.0,0.0,0.0,1.0])));
+ this.rawData[0] *= xScale; this.rawData[1] *= yScale; this.rawData[2] *= zScale;
+ this.rawData[4] *= xScale; this.rawData[5] *= yScale; this.rawData[6] *= zScale;
+ this.rawData[8] *= xScale; this.rawData[9] *= yScale; this.rawData[10] *= zScale;
+ this.rawData[12] *= xScale; this.rawData[13] *= yScale; this.rawData[14] *= zScale;
+ }
+
+ public function prependTranslation(x : Number,y : Number,z : Number) : void {
+ var m : Matrix3D = TEMP;
+ m.identity();
+ m.position=(new flash.geom.Vector3D(x,y,z));
+ this.prepend(m);
+ }
+
+ public function recompose(components : Vector.<flash.geom.Vector3D>,orientationStyle : String = null) : Boolean {
+ if(components.length < 3 || components[2].x == 0 || components[2].y == 0 || components[2].z == 0) return false;
+ if(orientationStyle == null) orientationStyle = flash.geom.Orientation3D.EULER_ANGLES;
+ this.identity();
+ var scale : Array = [];
+ scale[0] = scale[1] = scale[2] = components[2].x;
+ scale[4] = scale[5] = scale[6] = components[2].y;
+ scale[8] = scale[9] = scale[10] = components[2].z;
+ switch(orientationStyle) {
+ case flash.geom.Orientation3D.EULER_ANGLES:
+ {
+ var cx : Number = Math.cos(components[1].x);
+ var cy : Number = Math.cos(components[1].y);
+ var cz : Number = Math.cos(components[1].z);
+ var sx : Number = Math.sin(components[1].x);
+ var sy : Number = Math.sin(components[1].y);
+ var sz : Number = Math.sin(components[1].z);
+ this.rawData[0] = cy * cz * scale[0];
+ this.rawData[1] = cy * sz * scale[1];
+ this.rawData[2] = -sy * scale[2];
+ this.rawData[3] = 0;
+ this.rawData[4] = (sx * sy * cz - cx * sz) * scale[4];
+ this.rawData[5] = (sx * sy * sz + cx * cz) * scale[5];
+ this.rawData[6] = sx * cy * scale[6];
+ this.rawData[7] = 0;
+ this.rawData[8] = (cx * sy * cz + sx * sz) * scale[8];
+ this.rawData[9] = (cx * sy * sz - sx * cz) * scale[9];
+ this.rawData[10] = cx * cy * scale[10];
+ this.rawData[11] = 0;
+ this.rawData[12] = components[0].x;
+ this.rawData[13] = components[0].y;
+ this.rawData[14] = components[0].z;
+ this.rawData[15] = 1;
+ }
+ break;
+ default:
+ {
+ var x : Number = components[1].x as Number;
+ var y : Number = components[1].y as Number;
+ var z : Number = components[1].z as Number;
+ var w : Number = components[1].w as Number;
+ if(orientationStyle==flash.geom.Orientation3D.AXIS_ANGLE) {
+ x *= Math.sin(w / 2);
+ y *= Math.sin(w / 2);
+ z *= Math.sin(w / 2);
+ w = Math.cos(w / 2);
+ };
+ this.rawData[0] = (1 - 2 * y * y - 2 * z * z) * scale[0];
+ this.rawData[1] = (2 * x * y + 2 * w * z) * scale[1];
+ this.rawData[2] = (2 * x * z - 2 * w * y) * scale[2];
+ this.rawData[3] = 0;
+ this.rawData[4] = (2 * x * y - 2 * w * z) * scale[4];
+ this.rawData[5] = (1 - 2 * x * x - 2 * z * z) * scale[5];
+ this.rawData[6] = (2 * y * z + 2 * w * x) * scale[6];
+ this.rawData[7] = 0;
+ this.rawData[8] = (2 * x * z + 2 * w * y) * scale[8];
+ this.rawData[9] = (2 * y * z - 2 * w * x) * scale[9];
+ this.rawData[10] = (1 - 2 * x * x - 2 * y * y) * scale[10];
+ this.rawData[11] = 0;
+ this.rawData[12] = components[0].x;
+ this.rawData[13] = components[0].y;
+ this.rawData[14] = components[0].z;
+ this.rawData[15] = 1;
+ }
+ break;
+ };
+ if(components[2].x === 0) this.rawData[0] = 1e-15;
+ if(components[2].y === 0) this.rawData[5] = 1e-15;
+ if(components[2].z === 0) this.rawData[10] = 1e-15;
+ return !(components[2].x === 0 || components[2].y === 0 || components[2].y === 0);
+ }
+
+ public function transformVector(v : flash.geom.Vector3D) : flash.geom.Vector3D {
+ var x : Number = v.x;
+ var y : Number = v.y;
+ var z : Number = v.z;
+ return new flash.geom.Vector3D(x * this.rawData[0] + y * this.rawData[4] + z * this.rawData[8] + this.rawData[12],x * this.rawData[1] + y * this.rawData[5] + z * this.rawData[9] + this.rawData[13],x * this.rawData[2] + y * this.rawData[6] + z * this.rawData[10] + this.rawData[14],x * this.rawData[3] + y * this.rawData[7] + z * this.rawData[11] + this.rawData[15]);
+ }
+
+ public function transformVectors(vin : Vector.<Number>,vout : Vector.<Number>) : void {
+ var i : int = 0;
+ while(i + 3 <= vin.length) {
+ var x : Number = vin[i] as Number;
+ var y : Number = vin[i + 1] as Number;
+ var z : Number = vin[i + 2] as Number;
+ vout[i] = x * this.rawData[0] + y * this.rawData[4] + z * this.rawData[8] + this.rawData[12];
+ vout[i + 1] = x * this.rawData[1] + y * this.rawData[5] + z * this.rawData[9] + this.rawData[13];
+ vout[i + 2] = x * this.rawData[2] + y * this.rawData[6] + z * this.rawData[10] + this.rawData[14];
+ i += 3;
+ }
+ }
+
+ public function transpose() : void {
+ var oRawData : Vector.<Number> = this.rawData.concat();
+ this.rawData[1] = oRawData[4];
+ this.rawData[2] = oRawData[8];
+ this.rawData[3] = oRawData[12];
+ this.rawData[4] = oRawData[1];
+ this.rawData[6] = oRawData[9];
+ this.rawData[7] = oRawData[13];
+ this.rawData[8] = oRawData[2];
+ this.rawData[9] = oRawData[6];
+ this.rawData[11] = oRawData[14];
+ this.rawData[12] = oRawData[3];
+ this.rawData[13] = oRawData[7];
+ this.rawData[14] = oRawData[11];
+ }
+
+ static public function interpolate(thisMat : Matrix3D,toMat : Matrix3D,percent : Number) : Matrix3D {
+ var m : Matrix3D = new Matrix3D();
+ {
+ var _g : int = 0;
+ while(_g < 16) {
+ var i : int = _g++;
+ m.rawData[i] = thisMat.rawData[i] + (toMat.rawData[i] - thisMat.rawData[i]) * percent;
+ }
+ };
+ return m;
+ }
+
+ static protected function getAxisRotation(x : Number,y : Number,z : Number,degrees : Number,target:Matrix3D=null) : Matrix3D {
+ var m : Matrix3D =target|| new Matrix3D();
+ var rad : Number = -degrees * (Math.PI / 180);
+ var c : Number = Math.cos(rad);
+ var s : Number = Math.sin(rad);
+ var t : Number = 1.0 - c;
+ m.rawData[0] = c + x * x * t;
+ m.rawData[5] = c + y * y * t;
+ m.rawData[10] = c + z * z * t;
+ var tmp1 : Number = x * y * t;
+ var tmp2 : Number = z * s;
+ m.rawData[4] = tmp1 + tmp2;
+ m.rawData[1] = tmp1 - tmp2;
+ tmp1 = x * z * t;
+ tmp2 = y * s;
+ m.rawData[8] = tmp1 - tmp2;
+ m.rawData[2] = tmp1 + tmp2;
+ tmp1 = y * z * t;
+ tmp2 = x * s;
+ m.rawData[9] = tmp1 + tmp2;
+ m.rawData[6] = tmp1 - tmp2;
+ return m;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Orientation3D.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Orientation3D.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Orientation3D.as
new file mode 100644
index 0000000..a65266a
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Orientation3D.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.geom
+{
+ [Version("10")]
+ public final class Orientation3D extends Object
+ {
+
+ public static const EULER_ANGLES:String = "eulerAngles";
+
+ public static const AXIS_ANGLE:String = "axisAngle";
+
+ public static const QUATERNION:String = "quaternion";
+
+ public function Orientation3D()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/PerspectiveProjection.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/PerspectiveProjection.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/PerspectiveProjection.as
new file mode 100644
index 0000000..3d5e7c8
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/PerspectiveProjection.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.geom
+{
+ [Version("10")]
+ public class PerspectiveProjection extends Object
+ {
+
+ public function PerspectiveProjection()
+ {
+ super();
+ this.ctor();
+ }
+
+ private function ctor() : void{}
+
+ public function get fieldOfView() : Number{return 0}
+
+ public function set fieldOfView(param1:Number) : void{}
+
+ public function get projectionCenter() : Point{return null}
+
+ public function set projectionCenter(param1:Point) : *{return null}
+
+ public function get focalLength() : Number{return 0}
+
+ public function set focalLength(param1:Number) : void{}
+
+ public function toMatrix3D() : Matrix3D{return null}
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Point.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Point.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Point.as
new file mode 100644
index 0000000..cb103c6
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/geom/Point.as
@@ -0,0 +1,109 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flash.geom
+{
+ public class Point extends Object
+ {
+
+ public var x:Number;
+
+ public var y:Number;
+
+ public function Point(x:Number = 0, y:Number = 0)
+ {
+ super();
+ this.x = x;
+ this.y = y;
+ }
+
+ public static function interpolate(pt1:Point, pt2:Point, f:Number) : Point
+ {
+ return new Point(pt2.x + f * (pt1.x - pt2.x),pt2.y + f * (pt1.y - pt2.y));
+ }
+
+ public static function distance(pt1:Point, pt2:Point) : Number
+ {
+ return pt1.subtract(pt2).length;
+ }
+
+ public static function polar(len:Number, angle:Number) : Point
+ {
+ return new Point(len * Math.cos(angle),len * Math.sin(angle));
+ }
+
+ public function get length() : Number
+ {
+ return Math.sqrt(this.x * this.x + this.y * this.y);
+ }
+
+ public function clone() : Point
+ {
+ return new Point(this.x,this.y);
+ }
+
+ public function offset(dx:Number, dy:Number) : void
+ {
+ this.x = this.x + dx;
+ this.y = this.y + dy;
+ }
+
+ public function equals(toCompare:Point) : Boolean
+ {
+ return toCompare.x === this.x && toCompare.y === this.y;
+ }
+
+ public function subtract(v:Point) : Point
+ {
+ return new Point(this.x - v.x,this.y - v.y);
+ }
+
+ public function add(v:Point) : Point
+ {
+ return new Point(this.x + v.x,this.y + v.y);
+ }
+
+ public function normalize(thickness:Number) : void
+ {
+ var invD:Number = this.length;
+ if(invD > 0)
+ {
+ invD = thickness / invD;
+ this.x = this.x * invD;
+ this.y = this.y * invD;
+ }
+ }
+
+ public function toString() : String
+ {
+ return "(x=" + this.x + ", y=" + this.y + ")";
+ }
+
+ public function copyFrom(sourcePoint:Point) : void
+ {
+ this.x = sourcePoint.x;
+ this.y = sourcePoint.y;
+ }
+
+ public function setTo(xa:Number, ya:Number) : void
+ {
+ this.x = xa;
+ this.y = ya;
+ }
+ }
+}