flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [8/8] flex-asjs git commit: Initial project setup from Lizhi’s SpriteFlexJS project
Date Wed, 22 Feb 2017 15:36:47 GMT
Initial project setup from Lizhi’s SpriteFlexJS project


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

Branch: refs/heads/feature/sprite-refactor
Commit: 2b7a1d9f4df08596d8cb39d61f158426a6d4429e
Parents: 2659d5e
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Wed Feb 22 16:36:32 2017 +0100
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Wed Feb 22 16:36:32 2017 +0100

----------------------------------------------------------------------
 .../projects/spriteflexjs/.vscode/tasks.json    |  10 +
 frameworks/projects/spriteflexjs/asconfig.json  |  21 +
 frameworks/projects/spriteflexjs/build.xml      | 116 ++++
 frameworks/projects/spriteflexjs/pom.xml        |  68 ++
 .../src/main/config/compile-as-config.xml       |  82 +++
 .../spriteflexjs/src/main/flex/ArgumentError.as |  32 +
 .../spriteflexjs/src/main/flex/Error.as         |  88 +++
 .../spriteflexjs/src/main/flex/SpriteClasses.as |  34 +
 .../spriteflexjs/src/main/flex/SpriteFlexjs.as  |  56 ++
 .../main/flex/flash/__native/BaseRenderer.as    |  93 +++
 .../main/flex/flash/__native/BitmapTexture.as   |  41 ++
 .../main/flex/flash/__native/GLCanvasPattern.as |  39 ++
 .../__native/GLCanvasRenderingContext2D.as      | 685 +++++++++++++++++++
 .../main/flex/flash/__native/GLCanvasState.as   |  36 +
 .../src/main/flex/flash/__native/GLDrawable.as  |  55 ++
 .../main/flex/flash/__native/GLGraphicsPath.as  | 131 ++++
 .../flex/flash/__native/GLIndexBufferSet.as     |  60 ++
 .../src/main/flex/flash/__native/GLPath2D.as    | 130 ++++
 .../flex/flash/__native/GLVertexBufferSet.as    |  57 ++
 .../src/main/flex/flash/__native/IRenderer.as   |  67 ++
 .../src/main/flex/flash/__native/MemArray.as    |  39 ++
 .../main/flex/flash/__native/WebGLRenderer.as   | 124 ++++
 .../src/main/flex/flash/display/Bitmap.as       | 110 +++
 .../src/main/flex/flash/display/BitmapData.as   | 355 ++++++++++
 .../flex/flash/display/BitmapDataChannel.as     |  30 +
 .../src/main/flex/flash/display/BlendMode.as    |  81 +++
 .../src/main/flex/flash/display/CapsStyle.as    |  35 +
 .../main/flex/flash/display/DisplayObject.as    | 405 +++++++++++
 .../flash/display/DisplayObjectContainer.as     | 218 ++++++
 .../src/main/flex/flash/display/GradientType.as |  33 +
 .../src/main/flex/flash/display/Graphics.as     | 451 ++++++++++++
 .../flex/flash/display/GraphicsBitmapFill.as    |  69 ++
 .../main/flex/flash/display/GraphicsEndFill.as  |  87 +++
 .../flex/flash/display/GraphicsGradientFill.as  | 138 ++++
 .../src/main/flex/flash/display/GraphicsPath.as | 221 ++++++
 .../flex/flash/display/GraphicsPathCommand.as   |  48 ++
 .../flex/flash/display/GraphicsPathWinding.as   |  33 +
 .../flex/flash/display/GraphicsSolidFill.as     |  61 ++
 .../main/flex/flash/display/GraphicsStroke.as   | 149 ++++
 .../flex/flash/display/GraphicsTrianglePath.as  |  70 ++
 .../main/flex/flash/display/IBitmapDrawable.as  |  24 +
 .../src/main/flex/flash/display/IDrawCommand.as |  24 +
 .../main/flex/flash/display/IGraphicsData.as    |  30 +
 .../main/flex/flash/display/IGraphicsFill.as    |  25 +
 .../main/flex/flash/display/IGraphicsPath.as    |  24 +
 .../main/flex/flash/display/IGraphicsStroke.as  |  24 +
 .../flex/flash/display/InteractiveObject.as     |  71 ++
 .../flex/flash/display/InterpolationMethod.as   |  33 +
 .../src/main/flex/flash/display/JointStyle.as   |  35 +
 .../main/flex/flash/display/LineScaleMode.as    |  37 +
 .../src/main/flex/flash/display/Loader.as       | 193 ++++++
 .../src/main/flex/flash/display/LoaderInfo.as   | 125 ++++
 .../src/main/flex/flash/display/Shape.as        |  50 ++
 .../src/main/flex/flash/display/SpreadMethod.as |  35 +
 .../src/main/flex/flash/display/Sprite.as       |  89 +++
 .../src/main/flex/flash/display/Stage.as        | 414 +++++++++++
 .../src/main/flex/flash/display/Stage3D.as      |  80 +++
 .../src/main/flex/flash/display/StageAlign.as   |  45 ++
 .../flex/flash/display/StageDisplayState.as     |  35 +
 .../src/main/flex/flash/display/StageQuality.as |  45 ++
 .../main/flex/flash/display/StageScaleMode.as   |  37 +
 .../main/flex/flash/display/TriangleCulling.as  |  35 +
 .../src/main/flex/flash/display3D/Context3D.as  | 391 +++++++++++
 .../flash/display3D/Context3DBlendFactor.as     |  75 ++
 .../flash/display3D/Context3DBufferUsage.as     |  33 +
 .../flex/flash/display3D/Context3DClearMask.as  |  37 +
 .../flash/display3D/Context3DCompareMode.as     |  71 ++
 .../flex/flash/display3D/Context3DMipFilter.as  |  35 +
 .../flex/flash/display3D/Context3DProfile.as    |  41 ++
 .../flash/display3D/Context3DProgramType.as     |  33 +
 .../flex/flash/display3D/Context3DRenderMode.as |  33 +
 .../flash/display3D/Context3DStencilAction.as   |  45 ++
 .../flash/display3D/Context3DTextureFilter.as   |  41 ++
 .../flash/display3D/Context3DTextureFormat.as   |  41 ++
 .../flash/display3D/Context3DTriangleFace.as    |  54 ++
 .../display3D/Context3DVertexBufferFormat.as    |  39 ++
 .../flex/flash/display3D/Context3DWrapMode.as   |  37 +
 .../main/flex/flash/display3D/IndexBuffer3D.as  |  48 ++
 .../src/main/flex/flash/display3D/Program3D.as  |  83 +++
 .../main/flex/flash/display3D/VertexBuffer3D.as |  48 ++
 .../flash/display3D/textures/CubeTexture.as     |  38 +
 .../display3D/textures/RectangleTexture.as      |  36 +
 .../flex/flash/display3D/textures/Texture.as    |  69 ++
 .../flash/display3D/textures/TextureBase.as     |  33 +
 .../flash/display3D/textures/VideoTexture.as    |  38 +
 .../src/main/flex/flash/errors/IOError.as       |  29 +
 .../flex/flash/errors/IllegalOperationError.as  |  29 +
 .../src/main/flex/flash/events/ErrorEvent.as    |  49 ++
 .../src/main/flex/flash/events/Event.as         | 176 +++++
 .../main/flex/flash/events/EventDispatcher.as   | 130 ++++
 .../main/flex/flash/events/HTTPStatusEvent.as   |  92 +++
 .../main/flex/flash/events/IEventDispatcher.as  |  29 +
 .../src/main/flex/flash/events/IOErrorEvent.as  |  50 ++
 .../src/main/flex/flash/events/KeyboardEvent.as | 111 +++
 .../src/main/flex/flash/events/MouseEvent.as    | 217 ++++++
 .../src/main/flex/flash/events/ProgressEvent.as |  70 ++
 .../flex/flash/events/SecurityErrorEvent.as     |  41 ++
 .../src/main/flex/flash/events/TextEvent.as     |  60 ++
 .../src/main/flex/flash/events/TimerEvent.as    |  49 ++
 .../src/main/flex/flash/events/TouchEvent.as    | 232 +++++++
 .../main/flex/flash/events/VideoTextureEvent.as |  47 ++
 .../src/main/flex/flash/filters/BitmapFilter.as |  34 +
 .../src/main/flex/flash/geom/ColorTransform.as  | 133 ++++
 .../src/main/flex/flash/geom/FMatrix.as         | 276 ++++++++
 .../src/main/flex/flash/geom/Matrix.as          | 276 ++++++++
 .../src/main/flex/flash/geom/Matrix3D.as        | 645 +++++++++++++++++
 .../src/main/flex/flash/geom/Orientation3D.as   |  36 +
 .../flex/flash/geom/PerspectiveProjection.as    |  47 ++
 .../src/main/flex/flash/geom/Point.as           | 109 +++
 .../src/main/flex/flash/geom/Rectangle.as       | 265 +++++++
 .../src/main/flex/flash/geom/Transform.as       | 128 ++++
 .../src/main/flex/flash/geom/Utils3D.as         |  35 +
 .../src/main/flex/flash/geom/Vector3D.as        | 211 ++++++
 .../src/main/flex/flash/media/Camera.as         | 176 +++++
 .../src/main/flex/flash/media/ID3Info.as        |  44 ++
 .../src/main/flex/flash/media/Sound.as          | 180 +++++
 .../src/main/flex/flash/media/SoundChannel.as   |  62 ++
 .../src/main/flex/flash/media/SoundCodec.as     |  38 +
 .../main/flex/flash/media/SoundLoaderContext.as |  36 +
 .../src/main/flex/flash/media/SoundMixer.as     |  93 +++
 .../src/main/flex/flash/media/SoundTransform.as |  99 +++
 .../src/main/flex/flash/net/Socket.as           |  77 +++
 .../src/main/flex/flash/net/URLLoader.as        | 112 +++
 .../main/flex/flash/net/URLLoaderDataFormat.as  |  35 +
 .../src/main/flex/flash/net/URLRequest.as       |  98 +++
 .../src/main/flex/flash/net/URLRequestHeader.as |  35 +
 .../src/main/flex/flash/net/URLRequestMethod.as |  41 ++
 .../src/main/flex/flash/net/URLStream.as        | 120 ++++
 .../src/main/flex/flash/net/URLVariables.as     | 118 ++++
 .../src/main/flex/flash/net/navigateToURL.as    |  25 +
 .../src/main/flex/flash/system/Capabilities.as  | 131 ++++
 .../src/main/flex/flash/system/LoaderContext.as |  35 +
 .../src/main/flex/flash/system/System.as        | 128 ++++
 .../src/main/flex/flash/text/AntiAliasType.as   |  33 +
 .../src/main/flex/flash/text/CSMSettings.as     |  38 +
 .../src/main/flex/flash/text/Font.as            |  53 ++
 .../src/main/flex/flash/text/FontStyle.as       |  37 +
 .../src/main/flex/flash/text/FontType.as        |  35 +
 .../src/main/flex/flash/text/GridFitType.as     |  35 +
 .../src/main/flex/flash/text/StaticText.as      |  36 +
 .../src/main/flex/flash/text/StyleSheet.as      | 223 ++++++
 .../src/main/flex/flash/text/TextColorType.as   |  33 +
 .../src/main/flex/flash/text/TextDisplayMode.as |  35 +
 .../src/main/flex/flash/text/TextExtent.as      |  47 ++
 .../src/main/flex/flash/text/TextField.as       | 528 ++++++++++++++
 .../main/flex/flash/text/TextFieldAutoSize.as   |  37 +
 .../src/main/flex/flash/text/TextFieldType.as   |  33 +
 .../src/main/flex/flash/text/TextFormat.as      | 172 +++++
 .../src/main/flex/flash/text/TextFormatAlign.as |  41 ++
 .../main/flex/flash/text/TextFormatDisplay.as   |  34 +
 .../main/flex/flash/text/TextInteractionMode.as |  33 +
 .../src/main/flex/flash/text/TextLineMetrics.as |  47 ++
 .../src/main/flex/flash/text/TextRenderer.as    |  55 ++
 .../src/main/flex/flash/text/TextRun.as         |  39 ++
 .../src/main/flex/flash/text/TextSnapshot.as    |  65 ++
 .../src/main/flex/flash/ui/KeyLocation.as       |  40 ++
 .../src/main/flex/flash/ui/Keyboard.as          | 607 ++++++++++++++++
 .../src/main/flex/flash/ui/KeyboardType.as      |  36 +
 .../src/main/flex/flash/ui/Mouse.as             |  65 ++
 .../src/main/flex/flash/ui/MouseCursor.as       |  40 ++
 .../src/main/flex/flash/ui/Multitouch.as        |  70 ++
 .../main/flex/flash/ui/MultitouchInputMode.as   |  35 +
 .../src/main/flex/flash/utils/ByteArray.as      | 314 +++++++++
 .../src/main/flex/flash/utils/Dictionary.as     |  35 +
 .../src/main/flex/flash/utils/Endian.as         |  33 +
 .../src/main/flex/flash/utils/Proxy.as          |  57 ++
 .../main/flex/flash/utils/SetIntervalTimer.as   |  67 ++
 .../src/main/flex/flash/utils/Timer.as          | 131 ++++
 .../flex/flash/utils/__js/clearIntervalJS.as    |  25 +
 .../main/flex/flash/utils/__js/setIntervalJS.as |  25 +
 .../src/main/flex/flash/utils/clearInterval.as  |  26 +
 .../flex/flash/utils/getDefinitionByName.as     |  25 +
 .../flex/flash/utils/getQualifiedClassName.as   |  25 +
 .../src/main/flex/flash/utils/getTimer.as       |  25 +
 .../src/main/flex/flash/utils/setInterval.as    |  26 +
 .../src/main/flex/flash/utils/setTimeout.as     |  25 +
 .../src/main/resources/sprite-as-manifest.xml   |  25 +
 .../src/main/resources/sprite-manifest.xml      |  25 +
 178 files changed, 16327 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/.vscode/tasks.json
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/.vscode/tasks.json b/frameworks/projects/spriteflexjs/.vscode/tasks.json
new file mode 100644
index 0000000..c207148
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/.vscode/tasks.json
@@ -0,0 +1,10 @@
+{
+	// See https://go.microsoft.com/fwlink/?LinkId=733558
+	// for the documentation about the tasks.json format
+	//"--flexHome=/Users/carlosrovira/Dev/Flex/sdks/flexjs-0.8.0"
+	"version": "0.1.0",
+	"command": "mvn",
+	"args": ["clean", "install", "-DskipTests"],
+	"isShellCommand": true,
+	"showOutput": "always"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/asconfig.json
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/asconfig.json b/frameworks/projects/spriteflexjs/asconfig.json
new file mode 100644
index 0000000..706a181
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/asconfig.json
@@ -0,0 +1,21 @@
+{
+    "config": "flex",
+    "compilerOptions": {
+        "debug": true,
+        "js-output-type": "flexjs",
+        "define": [
+            {
+                "name": "COMPILE::SWF",
+                "value": true
+            },
+            {
+                "name": "COMPILE::JS",
+                "value": false
+            }
+        ]
+    },
+    "files":
+    [
+        "src/main/flex/MDLClasses.as"
+    ]
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/build.xml b/frameworks/projects/spriteflexjs/build.xml
new file mode 100644
index 0000000..faae86c
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/build.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<!--
+
+  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.
+
+-->
+
+
+<project name="Sprite" default="main" basedir=".">
+    <property name="FLEXJS_HOME" location="../../.."/>
+    
+    <property file="${FLEXJS_HOME}/env.properties"/>
+    <property environment="env"/>
+    <property file="${FLEXJS_HOME}/build.properties"/>
+    <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+    
+    <property name="target.name" value="${ant.project.name}.swc" />
+    
+    <target name="main" depends="clean,check-compiler,compile,compile-js,copy-swc,test" description="Full build of ${ant.project.name}.swc">
+    </target>
+    
+    <target name="compile-js">
+        <ant dir="${FLEXJS_HOME}/frameworks/js/FlexJS/projects/${ant.project.name}JS/" inheritAll="false" />
+    </target>
+    
+    <target name="copy-swc">
+        <copy file="${basedir}/target/${target.name}" tofile="${FLEXJS_HOME}/frameworks/libs/${target.name}" />
+    </target>
+    
+    <target name="check-for-tests" >
+        <condition property="skip-tests" >
+            <not>
+                <available file="${basedir}/src/test/flex/build.xml" />
+            </not>
+        </condition>
+    </target>
+    
+    <target name="test" depends="check-for-tests" unless="skip-tests">
+        <ant dir="src/test/flex" />
+    </target>
+    
+    <target name="clean">
+        <delete failonerror="false">
+            <fileset dir="${FLEXJS_HOME}/frameworks/libs">
+                <include name="${target.name}"/>
+            </fileset>
+        </delete>
+        <delete failonerror="false" includeemptydirs="true">
+            <fileset dir="${basedir}/target">
+                <include name="**/**"/>
+            </fileset>
+        </delete>
+        <antcall target="clean-tests" />
+    </target>
+    
+    <target name="clean-tests" depends="check-for-tests" unless="skip-tests">
+        <ant dir="src/test/flex" target="clean"/>
+    </target>
+    
+    <target name="compile" description="Compiles .as files into .swc">
+        <echo message="Compiling libs/${ant.project.name}.swc"/>
+        <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+        <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+        
+        <compc fork="true"
+            output="${basedir}/target/${target.name}">
+            <jvmarg line="${compc.jvm.args}"/>
+            <load-config filename="${basedir}/src/main/config/compile-as-config.xml" />
+            <arg value="+playerglobal.version=${playerglobal.version}" />
+            <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+            <arg value="-define=COMPILE::SWF,true" />
+            <arg value="-define=COMPILE::JS,false" />
+        </compc>
+        <copy file="${basedir}/target/${target.name}" tofile="${FLEXJS_HOME}/frameworks/libs/${target.name}" />
+    </target>
+    
+    <target name="check-compiler" depends="check-falcon-home">
+        <path id="lib.path">
+            <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/>
+        </path>
+        <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+    </target>
+    
+    <target name="check-falcon-home" unless="FALCON_HOME"
+        description="Check FALCON_HOME is a directory.">
+        
+        <echo message="FALCON_HOME is ${env.FALCON_HOME}"/>
+        
+        <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+        type="file"
+        property="FALCON_HOME"
+        value="${env.FALCON_HOME}"/>
+        
+        <available file="${FLEXJS_HOME}/../flex-falcon/compiler/lib/falcon-mxmlc.jar"
+        type="file"
+        property="FALCON_HOME"
+        value="${FLEXJS_HOME}/../flex-falcon/compiler"/>
+        
+        <fail message="FALCON_HOME must be set to a folder with a lib sub-folder containing falcon-mxmlc.jar such as the compiler folder in flex-falcon repo or a FlexJS SDK folder"
+        unless="FALCON_HOME"/>
+    </target>
+    
+</project>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/pom.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/pom.xml b/frameworks/projects/spriteflexjs/pom.xml
new file mode 100644
index 0000000..d1e44c1
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.flex.flexjs.framework</groupId>
+    <artifactId>projects</artifactId>
+    <version>0.8.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>spriteflexjs</artifactId>
+  <version>0.8.0-SNAPSHOT</version>
+  <packaging>swc</packaging>
+
+  <name>Apache Flex - FlexJS: Framework: Libs: spriteflexjs</name>
+
+  <build>
+    <sourceDirectory>src/main/flex</sourceDirectory>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.flex.flexjs.compiler</groupId>
+        <artifactId>flexjs-maven-plugin</artifactId>
+        <version>${flexjs.compiler.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <skipAS>true</skipAS>
+          <namespaces>
+            <namespace>
+              <uri>library://ns.apache.org/flexjs/sprite</uri>
+              <manifest>${project.basedir}/src/main/resources/sprite-manifest.xml</manifest>
+            </namespace>
+            <namespace>
+              <type>as</type>
+              <uri>library://ns.apache.org/flexjs/sprite</uri>
+              <manifest>${project.basedir}/src/main/resources/sprite-as-manifest.xml</manifest>
+            </namespace>
+          </namespaces>
+          <includeClasses>
+            <includeClass>SpriteClasses</includeClass>
+          </includeClasses>
+          <includeLookupOnly>true</includeLookupOnly>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+  </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml b/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml
new file mode 100644
index 0000000..e34c3a1
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml
@@ -0,0 +1,82 @@
+<!--
+
+  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.
+
+-->
+<flex-config>
+
+    <compiler>
+        <accessible>false</accessible>
+        
+        <external-library-path>
+            <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
+            <path-element>../../../../../libs/Binding.swc</path-element>
+            <path-element>../../../../../libs/Core.swc</path-element>
+            <path-element>../../../../../libs/Graphics.swc</path-element>
+            <path-element>../../../../../libs/HTML.swc</path-element>
+        </external-library-path>
+        
+		<mxml>
+			<children-as-data>true</children-as-data>
+		</mxml>
+		<binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+		<binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+		<binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+        <keep-as3-metadata>
+          <name>Bindable</name>
+          <name>Managed</name>
+          <name>ChangeEvent</name>
+          <name>NonCommittingChangeEvent</name>
+          <name>Transient</name>
+        </keep-as3-metadata>
+	  
+        <locale/>
+        
+        <library-path/>
+
+        <namespaces>
+            <namespace>
+                <uri>library://ns.apache.org/flexjs/sprite</uri>
+                <manifest>../resources/sprite-manifest.xml</manifest>
+            </namespace>
+            <namespace>
+                <uri>library://ns.apache.org/flexjs/sprite</uri>
+                <manifest>../resources/sprite-as-manifest.xml</manifest>
+            </namespace>
+        </namespaces>
+        
+        <source-path>
+            <path-element>../flex</path-element>
+        </source-path>
+        
+        <warn-no-constructor>false</warn-no-constructor>
+    </compiler>
+    
+    <include-lookup-only>true</include-lookup-only>
+    
+    <include-classes>
+        <class>SpriteClasses</class>
+    </include-classes>
+    
+    <include-namespaces>
+        <uri>library://ns.apache.org/flexjs/sprite</uri>
+    </include-namespaces>
+        
+    <target-player>${playerglobal.version}</target-player>
+	
+
+</flex-config>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/ArgumentError.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/ArgumentError.as b/frameworks/projects/spriteflexjs/src/main/flex/ArgumentError.as
new file mode 100644
index 0000000..22d6713
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/ArgumentError.as
@@ -0,0 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+   public dynamic class ArgumentError extends Error
+   {
+      
+      public static const length:int = 1;
+      
+      public function ArgumentError(message:* = "", id:* = 0)
+      {
+         super(message,id);
+         this.name = "ArgumentError";
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/Error.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/Error.as b/frameworks/projects/spriteflexjs/src/main/flex/Error.as
new file mode 100644
index 0000000..49f1272
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/Error.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+   public dynamic class Error extends Object
+   {
+      
+      public static const length:int = 1;
+      
+      
+      public var message:Object;
+      
+      public var name:String;
+      
+      private var _errorID:int;
+      
+      public function Error(message:* = "", id:* = 0)
+      {
+         super();
+         this.message = message;
+         this._errorID = id;
+         this.name ;
+      }
+      
+     public static function getErrorMessage(param1:int) : String{return null}
+      
+      public static function throwError(type:Class, index:uint, ... rest) : *
+      {
+         var i:* = 0;
+         var f:* = function(match:*, pos:*, string:*):*
+         {
+            var arg_num:* = -1;
+            switch(match.charAt(1))
+            {
+               case "1":
+                  break;
+               case "2":
+                  arg_num = 1;
+                  break;
+               case "3":
+                  arg_num = 2;
+                  break;
+               case "4":
+                  arg_num = 3;
+                  break;
+               case "5":
+                  arg_num = 4;
+                  break;
+               case "6":
+               case 6:
+                  arg_num = 5;
+                  break;
+               default:
+                  arg_num = 0;
+            }
+            if(arg_num > -1 && rest.length > arg_num)
+            {
+               return rest[arg_num];
+            }
+            return "";
+         };
+         throw new type(Error.getErrorMessage(index).replace(new RegExp("%[0-9]","g"),f),index);
+      }
+      
+     public function getStackTrace() : String{return null}
+      
+      public function get errorID() : int
+      {
+         return this._errorID;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.as b/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.as
new file mode 100644
index 0000000..ad3679d
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.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
+{
+
+	/**
+	*  @private
+	*  This class is used to link additional classes into sprite.swc
+	*  beyond those that are found by dependecy analysis starting
+	*  from the classes specified in manifest.xml.
+	*/
+	internal class SpriteClasses
+	{
+		import flash.__native.BaseRenderer;BaseRenderer;
+	}
+
+}
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/SpriteFlexjs.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/SpriteFlexjs.as b/frameworks/projects/spriteflexjs/src/main/flex/SpriteFlexjs.as
new file mode 100644
index 0000000..6e1fa33
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/SpriteFlexjs.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 
+{
+	import flash.__native.BaseRenderer;
+	import flash.__native.IRenderer;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class SpriteFlexjs 
+	{
+		public static var stageWidth:Number = 800;
+		public static var stageHeight:Number = 600;
+		public static var autoSize:Boolean = false;
+		public static var startTime:Number = 0;
+		public static var drawCounter:int;
+		public static var batDrawCounter:int;
+		public static var debug:Boolean = false;
+		public static var wmode:String = "direct";//direct,gpu
+		public static var renderer:IRenderer = new BaseRenderer;
+		public static var dirtyGraphics:Boolean = true;
+		public static var requestAnimationFrame:Function =
+			window["requestAnimationFrame"]       ||
+			window["webkitRequestAnimationFrame"] ||
+			window["mozRequestAnimationFrame"]    ||
+			window["oRequestAnimationFrame"] ||
+			window["msRequestAnimationFrame"] ||
+			function(callback):void {
+				setTimeout(callback, 1000 / 60);
+			};
+
+		public function SpriteFlexjs() 
+		{
+			
+		}
+		
+	}
+
+}
\ 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/__native/BaseRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/BaseRenderer.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/BaseRenderer.as
new file mode 100644
index 0000000..29db5a6
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/BaseRenderer.as
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	import flash.display.BitmapData;
+	import flash.display.Graphics;
+	import flash.display.GraphicsEndFill;
+	import flash.display.GraphicsPath;
+	import flash.display.IGraphicsData;
+	import flash.geom.ColorTransform;
+	import flash.geom.Matrix;
+	import flash.text.TextFormat;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class BaseRenderer extends IRenderer
+	{
+		
+		protected var endFillInstance:GraphicsEndFill = new GraphicsEndFill;
+		public function BaseRenderer() 
+		{
+			
+		}
+		
+		override public function getCssColor(color:uint,alpha:Number, ct:ColorTransform,toarr:Array):Object 
+		{
+			return "rgba(" + int((color >> 16 & 0xff)*ct.redMultiplier+ct.redOffset) + "," + int((color >> 8 & 0xff)*ct.greenMultiplier+ct.greenOffset) + "," + int((color & 0xff)*ct.greenMultiplier+ct.greenOffset) + "," + (alpha*ct.alphaMultiplier+ct.alphaOffset) + ")";
+		}
+		
+		override public function createPath():GraphicsPath 
+		{
+			return new GraphicsPath;
+		}
+		
+		override public function renderGraphics(ctx:CanvasRenderingContext2D,g:Graphics,m:Matrix,blendMode:String,colorTransform:ColorTransform):void{
+			ctx.setTransform(m.a, m.b, m.c, m.d, m.tx, m.ty);
+			ctx.globalCompositeOperation = blendMode;//BlendMode.getCompVal(blendMode);
+			var len:int = g.graphicsData.length;
+			for (var i:int = 0; i < len;i++ )
+			{
+				var igd:IGraphicsData = g.graphicsData[i];
+				igd.draw(ctx,colorTransform);
+			}
+			if (g.lastFill)
+			{
+				endFillInstance.fill = g.lastFill;
+				endFillInstance.draw(ctx,colorTransform);
+			}
+			
+			if (g.lastStroke)
+			{
+				ctx.stroke();
+			}
+			ctx.fillStyle = null;
+			ctx.strokeStyle = null;
+		}
+		
+		override public function renderImage(ctx:CanvasRenderingContext2D,img:BitmapData,m:Matrix,blendMode:String,colorTransform:ColorTransform):void{
+			ctx.globalAlpha = colorTransform.alphaMultiplier;
+			ctx.globalCompositeOperation = blendMode;
+			ctx.setTransform(m.a, m.b, m.c, m.d, m.tx, m.ty);
+			ctx.drawImage(img.image, 0, 0);
+		}
+		
+		override public function renderText(ctx:CanvasRenderingContext2D,txt:String,textFormat:TextFormat, m:Matrix, blendMode:String, colorTransform:ColorTransform,x:Number,y:Number):void{
+			ctx.globalAlpha = colorTransform.alphaMultiplier;
+			ctx.globalCompositeOperation = blendMode;//BlendMode.getCompVal(blendMode);
+			ctx.setTransform(m.a, m.b, m.c, m.d, m.tx, m.ty);
+			ctx.font = textFormat.css;
+			ctx.fillStyle = textFormat.csscolor;
+			ctx.textBaseline = "top";
+			ctx.fillText(txt, x, y);
+		}
+	}
+
+}
\ 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/__native/BitmapTexture.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/BitmapTexture.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/BitmapTexture.as
new file mode 100644
index 0000000..2bef757
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/BitmapTexture.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.__native 
+{
+	import flash.display.BitmapData;
+	import flash.display3D.textures.Texture;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class BitmapTexture 
+	{
+		public var texture:Texture;
+		public var bmd:BitmapData;
+		public var img:Object;
+		public var width:int;
+		public var height:int;
+		public function BitmapTexture() 
+		{
+			
+		}
+		
+	}
+
+}
\ 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/__native/GLCanvasPattern.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasPattern.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasPattern.as
new file mode 100644
index 0000000..706eea7
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasPattern.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class GLCanvasPattern 
+	{
+		public var image:Object;
+		public var repetition:String;
+		
+		public function GLCanvasPattern(image:Object,repetition:String) 
+		{
+			this.repetition = repetition;
+			this.image = image;
+			
+		}
+		
+	}
+
+}
\ 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/__native/GLCanvasRenderingContext2D.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasRenderingContext2D.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasRenderingContext2D.as
new file mode 100644
index 0000000..dd248a2
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasRenderingContext2D.as
@@ -0,0 +1,685 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	import flash.display.BitmapData;
+	import flash.display.GraphicsPath;
+	import flash.display.Stage;
+	import flash.display3D.Context3D;
+	import flash.display3D.Context3DBlendFactor;
+	import flash.display3D.Context3DProgramType;
+	import flash.display3D.Context3DTextureFormat;
+	import flash.display3D.Context3DTriangleFace;
+	import flash.display3D.Context3DVertexBufferFormat;
+	import flash.display3D.IndexBuffer3D;
+	import flash.display3D.Program3D;
+	import flash.display3D.VertexBuffer3D;
+	import flash.display3D.textures.Texture;
+	import flash.display3D.textures.TextureBase;
+	import flash.events.Event;
+	import flash.geom.ColorTransform;
+	import flash.geom.Matrix;
+	import flash.geom.Matrix3D;
+	import flash.utils.ByteArray;
+	/**
+	 * ...
+	 * @author lizhi http://matrix3d.github.io/
+	 */
+	public class GLCanvasRenderingContext2D
+	{
+		public var canvas : HTMLCanvasElement;
+		public var fillColor : String;
+		public var fillStyle : String;
+		public var fillStyleIsImage:Boolean;
+		public var font : String;
+		public var getLineDash : Object;
+		public var globalAlpha : Number=1;
+		//public var globalRed : Number=1;
+		//public var globalGreen : Number=1;
+		//public var globalBlue : Number=1;
+		public var colorTransform:ColorTransform;
+		public var globalCompositeOperation : String;
+		public var lineCap : String;
+		public var lineJoin : String;
+		public var lineWidth : Number;
+		public var miterLimit : Number;
+		public var setFillColor : Object;
+		public var setLineDash : Object;
+		public var setStrokeColor : Object;
+		public var shadowBlur : Number;
+		public var shadowColor : String;
+		public var shadowOffsetX : Number;
+		public var shadowOffsetY : Number;
+		public var strokeColor : String;
+		public var strokeStyle : String;
+		public var textAlign : String;
+		public var textBaseline : String;
+		public var ctx:Context3D;
+		public var currentPath:GLPath2D;
+		private var text2img:Object = { };
+		public var bitmapDrawable:GLDrawable;
+		private var bitmapProg:Program3D;
+		private var colorProg:Program3D;
+		private var matr3d:Matrix3D = new Matrix3D;
+		private var uvmatr3d:Matrix3D = new Matrix3D;
+		public var matr:Matrix = new Matrix;
+		private var matrhelp:Matrix = new Matrix;
+		private var stage:Stage;
+		private var isBatch:Boolean;
+		private var batchs:Array = [];
+		private var batchsLen:int = 0;
+		private var states:Array = [];
+		private var statesPos:int = -1;
+		private var posPool:Object = {};
+		private var uvPool:Object = {};
+		private var colorPool:Object = {};
+		private var indexPool:Object = {};
+		private var newDrawable:GLDrawable = new GLDrawable(null, null, null,WebGLRenderingContext.DYNAMIC_DRAW);
+		
+		private var lastImage:Object;
+		private var lastImageIsImage:Object;
+		private var numPos:int = 0;
+		private var numIndex:int = 0;
+		private var updateColor:Boolean = true;
+		public function GLCanvasRenderingContext2D(stage:Stage,isBatch:Boolean=false) 
+		{
+			this.isBatch = isBatch;
+			this.stage = stage;
+			this.canvas = stage.canvas;
+			ctx = new Context3D;
+			ctx.canvas = canvas;
+			ctx.gl = (canvas.getContext("webgl", {alpha:false,antialias:false}) || canvas.getContext("experimental-webgl", {alpha:false,antialias:false})) as WebGLRenderingContext;
+			stage_resize(null);
+			ctx.setBlendFactors(Context3DBlendFactor.SOURCE_ALPHA, Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA);
+			ctx.setCulling(Context3DTriangleFace.NONE);
+			
+			var posData:Float32Array = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]);
+			var iData:Uint16Array = new Uint16Array([0, 2, 1, 2, 1, 3]);
+			bitmapDrawable = new GLDrawable(posData, posData,iData,ctx.gl.STATIC_DRAW);
+			
+			var vcode:String = 
+				"attribute vec2 va0;" +
+				"attribute vec4 va1;" +
+				"attribute vec2 va2;" +
+				"varying vec4 vColor;"+
+				"varying vec2 vUV;" +
+				"uniform mat4 vc0;"+
+				"uniform mat4 vc4;"+
+				"void main(void) {" +
+					"vColor=va1;"+
+					"vUV=(vc4*vec4(va2,0.0,1.0)).xy;"+
+					"gl_Position =vc0*vec4(va0, 0.0,1.0);"+
+				"}";
+			var fcode:String = "precision lowp float;" +
+				"varying vec4 vColor;"+
+				"varying vec2 vUV;"+
+				"uniform sampler2D fs0;"+
+			   "void main(void) {" +
+					"gl_FragColor = texture2D(fs0,vUV)*vColor;"+
+				"}";
+			bitmapProg = ctx.createProgram();
+			var vb:ByteArray = new ByteArray;
+			vb.writeUTFBytes( vcode);
+			var fb:ByteArray = new ByteArray;
+			fb.writeUTFBytes( fcode);
+			bitmapProg.upload(vb, fb);
+			
+			vcode = 
+				"attribute vec2 va0;" +
+				"attribute vec4 va1;" +
+				"varying vec4 vColor;"+
+				"uniform mat4 vc0;"+
+				"void main(void) {" +
+					"vColor=va1;"+
+					"gl_Position =vc0*vec4(va0, 0.0,1.0);"+
+				"}";
+			fcode = "precision lowp float;" +
+				"varying vec4 vColor;"+
+			   "void main(void) {" +
+					"gl_FragColor = vColor;"+
+				"}";
+			colorProg = ctx.createProgram();
+			vb = new ByteArray;
+			vb.writeUTFBytes( vcode);
+			fb = new ByteArray;
+			fb.writeUTFBytes(fcode);
+			colorProg.upload(vb, fb);
+			
+			stage.addEventListener(Event.RESIZE, stage_resize);
+		}
+		
+		private function stage_resize(e:Event):void 
+		{
+			ctx.configureBackBuffer(stage.stageWidth, stage.stageHeight, 0, false);
+		}
+		
+		public function arc (x:Number, y:Number, radius:Number, startAngle:Number, endAngle:Number/*, opt_anticlockwise:Boolean=false*/) : Object{
+			currentPath.path.arc(x, y, radius, startAngle, endAngle);
+			return null;
+		}
+
+		public function arcTo (x1:Number, y1:Number, x2:Number, y2:Number, radius:Number) : Object {
+			//currentPath.path.arc(x1, y1, x2, y2, radius);
+			return null;
+		}
+
+		/**
+		 * @flexjsignorecoercion flash.__native.GLGraphicsPath
+		 */
+		public function beginPath () : Object {
+			currentPath = new GLPath2D;
+			currentPath.path = SpriteFlexjs.renderer.createPath() as GLGraphicsPath;
+			currentPath.matr = matr;
+			return null;
+		}
+
+		public function bezierCurveTo (cp1x:Number, cp1y:Number, cp2x:Number, cp2y:Number, x:Number, y:Number) : Object {
+			currentPath.path.cubicCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
+			return null;
+		}
+
+		public function clearRect (x:Number, y:Number, w:Number, h:Number) : Object {
+			ctx.clear(1,1,1);
+			batchsLen = 0;
+			SpriteFlexjs.batDrawCounter = 0;
+			return null;
+		}
+
+		public function clip (opt_fillRule:String = "") : Object {
+			return null;
+		}
+
+		public function closePath () : Object {
+			return null;
+		}
+
+		public function createImageData (sw:Number, sh:Number) : ImageData {
+			return null;
+		}
+
+		public function createLinearGradient (x0:Number, y0:Number, x1:Number, y1:Number) : CanvasGradient {
+			return null;
+		}
+
+		/**
+		 * @flexjsignorecoercion CanvasPattern
+		 */
+		public function createPattern (image:Object, repetition:String) : CanvasPattern {
+			return new GLCanvasPattern(image,repetition) as CanvasPattern;
+		}
+
+		public function createRadialGradient (x0:Number, y0:Number, r0:Number, x1:Number, y1:Number, r1:Number) : CanvasGradient {
+			return null;
+		}
+
+		public function drawImage (image:Object, dx:Number, dy:Number/*, opt_dw:Number = 0, opt_dh:Number = 0, opt_sx:Number = 0, opt_sy:Number = 0, opt_sw:Number = 0, opt_sh:Number = 0*/) : Object {
+			drawImageInternal(image,bitmapDrawable, matr,null,true,colorTransform.tint,true,true);
+			return null;
+		}
+		
+		/**
+		 * @flexjsignorecoercion flash.__native.GLGraphicsPath
+		 */
+		public function drawPath (path:GraphicsPath, colorTransform:ColorTransform) : Object {
+			currentPath = path["glpath2d"];
+			if (path["glpath2d"]==null){
+				currentPath = path["glpath2d"] = new GLPath2D;
+			}
+			currentPath.path = path as GLGraphicsPath;
+			currentPath.matr = matr;
+			return null;
+		}
+		
+		/**
+		 * @flexjsignorecoercion Uint32Array
+		 */
+		public function drawImageInternal(image:Object, drawable:GLDrawable, posmatr:Matrix, uvmatr:Matrix, scaleWithImage:Boolean,color:uint,scaleWithImageUV:Boolean,isImage:Boolean):void{
+			if (!isBatch){
+				if(image){
+					var colorb:GLVertexBufferSet = drawable.color;
+					colorb.dirty = true;
+					var data:Uint32Array = colorb.data as Uint32Array;
+					var len:int = data.length;
+					for (var i:int = 0; i < len;i++ ){
+						data[i] = color;//color[0];
+						//data[i + 1] = color[1];
+						//data[i + 2] = color[2];
+						//data[i + 3] = color[3];
+					}
+					renderImage(image, drawable, posmatr, uvmatr, scaleWithImage, scaleWithImageUV, isImage);
+				}
+			}else{
+				if (!isImage&&!lastImageIsImage){
+					
+				}else if (image==null||lastImage != image){
+					if (numPos > 0){
+						batchFinish();
+					}
+					numPos = 0;
+					numIndex = 0;
+					lastImage = image;
+					lastImageIsImage = isImage;
+				}
+				if (drawable){
+					numPos += drawable.pos.data.length / 2;
+					numIndex += drawable.index.data.length / 3;
+				}
+				var batch:Array = batchs[batchsLen];
+				if (batch == null){
+					batch = batchs[batchsLen] = [];
+				}
+				batchsLen++;
+				batch[0] = image;
+				batch[1] = drawable;
+				batch[2] = posmatr;
+				batch[3] = uvmatr;
+				batch[4] = scaleWithImage;
+				batch[5] = color;
+				batch[6] = scaleWithImageUV;
+				batch[7] = isImage;
+			}
+		}
+		
+		private function renderImage(image:Object, drawable:GLDrawable, posmatr:Matrix, uvmatr:Matrix, scaleWithImage:Boolean,scaleWithImageUV:Boolean,isImage:Boolean):void{
+			SpriteFlexjs.batDrawCounter++;
+			if (!isImage){
+				ctx.setProgram(colorProg);
+			}else{
+				var texture:BitmapTexture = getTexture(image);
+				ctx.setProgram(bitmapProg);
+				ctx.setTextureAt(0, texture.texture);
+				ctx.setVertexBufferAt(2, drawable.uv.getBuff(ctx), 0, Context3DVertexBufferFormat.FLOAT_2);
+			}
+			ctx.setVertexBufferAt(0, drawable.pos.getBuff(ctx),0, Context3DVertexBufferFormat.FLOAT_2);
+			ctx.setVertexBufferAt(1, drawable.color.getBuff(ctx), 0, Context3DVertexBufferFormat.BYTES_4);
+			if(posmatr){
+				matr3d.rawData[0] = posmatr.a*2  / stage.stageWidth;
+				matr3d.rawData[1] = -posmatr.b*2 / stage.stageHeight;
+				matr3d.rawData[4] = posmatr.c*2 / stage.stageWidth;
+				matr3d.rawData[5] = -posmatr.d*2 / stage.stageHeight;
+				matr3d.rawData[12] = posmatr.tx * 2 / stage.stageWidth-1;
+				matr3d.rawData[13] = 1 - posmatr.ty * 2 / stage.stageHeight;
+			}else{
+				matr3d.rawData[0] = 2  / stage.stageWidth;
+				matr3d.rawData[1] = 0;
+				matr3d.rawData[4] = 0;
+				matr3d.rawData[5] = -2 / stage.stageHeight;
+				matr3d.rawData[12] = -1;
+				matr3d.rawData[13] = 1;
+			}
+			if (scaleWithImage){
+				matr3d.rawData[0] *= image.width;
+				matr3d.rawData[1] *= image.width;
+				matr3d.rawData[4] *= image.height;
+				matr3d.rawData[5] *= image.height;
+			}
+			
+			ctx.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, matr3d);
+			if(isImage){
+				if (uvmatr){
+					if(posmatr){
+						matrhelp.copyFrom(posmatr);
+						matrhelp.invert();
+						matrhelp.concat(uvmatr);
+					}else{
+						matrhelp.copyFrom(uvmatr);
+					}
+					uvmatr3d.rawData[0] = matrhelp.a / texture.width;
+					uvmatr3d.rawData[1] = -matrhelp.b / texture.width;
+					uvmatr3d.rawData[4] = -matrhelp.c / texture.height;
+					uvmatr3d.rawData[5] = matrhelp.d / texture.height;
+					uvmatr3d.rawData[12] = -matrhelp.tx/texture.width;
+					uvmatr3d.rawData[13] = -matrhelp.ty/texture.height;
+					if (scaleWithImageUV){
+						uvmatr3d.rawData[0] *= image.width;
+						uvmatr3d.rawData[1] *= image.width;
+						uvmatr3d.rawData[4] *= image.height;
+						uvmatr3d.rawData[5] *= image.height;
+					}
+				}else{
+					uvmatr3d.rawData[0] = 1 / texture.width;
+					uvmatr3d.rawData[1] = 0;
+					uvmatr3d.rawData[4] = 0;
+					uvmatr3d.rawData[5] = 1/ texture.height;
+					uvmatr3d.rawData[12] = 0;
+					uvmatr3d.rawData[13] = 0;
+					if (scaleWithImageUV){
+						uvmatr3d.rawData[0] *= image.width;
+						uvmatr3d.rawData[5] *= image.height;
+					}
+				}
+				ctx.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 4, uvmatr3d);
+			}
+			ctx.drawTriangles(drawable.index.getBuff(ctx),0,drawable.numTriangles);
+		}
+		
+		/**
+		 * @flexjsignorecoercion Float32Array
+		 * @flexjsignorecoercion Uint32Array
+		 * @flexjsignorecoercion Number
+		 */
+		private function batchFinish():void{
+			var posKey:int = getNextPow2(numPos);
+			var indexKey:int = getNextPow2(numIndex);
+			var newpos:GLVertexBufferSet = posPool[posKey];
+			var newuv:GLVertexBufferSet = uvPool[posKey];
+			var newcolor:GLVertexBufferSet = colorPool[posKey];
+			var newi:GLIndexBufferSet = indexPool[indexKey];
+			if (newpos==null){
+				newpos = posPool[posKey] = new GLVertexBufferSet(new Float32Array(posKey * 2), 2,ctx.gl.DYNAMIC_DRAW);
+				trace("bat new pos",posKey,numPos);
+			}
+			if (newuv==null&&lastImageIsImage){
+				newuv = uvPool[posKey] = new GLVertexBufferSet(new Float32Array(posKey * 2), 2, ctx.gl.DYNAMIC_DRAW);
+			}
+			if (newcolor==null&&updateColor){
+				newcolor = colorPool[posKey] = new GLVertexBufferSet(new Uint32Array(posKey), 4,ctx.gl.DYNAMIC_DRAW);
+			}
+			if (newi==null){
+				newi = indexPool[indexKey] = new GLIndexBufferSet(new Uint16Array(indexKey * 3),ctx.gl.DYNAMIC_DRAW);
+				trace("bat new index",indexKey,numIndex);
+			}
+			var newposdata:Float32Array = newpos.data as Float32Array;
+			if(lastImageIsImage){
+				var newuvdata:Float32Array = newuv.data as Float32Array;
+			}
+			if(updateColor){
+				var newcolordata:Uint32Array = newcolor.data as Uint32Array;
+			}
+			var newidata:Uint16Array = newi.data;
+			newDrawable.index = newi;
+			newDrawable.pos = newpos;
+			newDrawable.uv = newuv;
+			newDrawable.color = newcolor;
+			newDrawable.numTriangles = numIndex;
+			var si:int = 0;
+			var il:int = 0;
+			if (lastImageIsImage){
+				var iw:int = lastImage.width as Number;
+				var ih:int = lastImage.height as Number;
+			}
+			var len:int = batchsLen;
+			for (var i:int = 0; i < len; i++ ){
+				var batch:Array = batchs[i];
+				var drawable2:GLDrawable = batch[1]; 
+				var posmatr:Matrix = batch[2];
+				var scaleWithImage:Boolean = batch[4];
+				var scaleWithImageUV:Boolean = batch[6];
+				var color:uint = batch[5] as Number;
+				if(lastImageIsImage){
+					var uvmatr:Matrix = batch[3];
+					if(uvmatr){
+						matrhelp.copyFrom(posmatr);
+						matrhelp.invert();
+						matrhelp.concat(uvmatr);
+						matrhelp.b *=-1;
+						matrhelp.c *=-1;
+						matrhelp.tx *=-1;
+						matrhelp.ty *=-1;
+					}
+				}
+				var data:Float32Array = drawable2.pos.data as Float32Array;
+				if(lastImageIsImage){
+					var uvdata:Float32Array = drawable2.uv.data as Float32Array;
+				}
+				var len2:int = data.length/2 ;
+				for (var j:int = 0; j < len2; j++ ){
+					var x:Number = data[j*2] as Number;
+					var y:Number = data[j*2 + 1] as Number;
+					if (scaleWithImage){
+						x *= iw;
+						y *= ih;
+					}
+					var x2:Number = posmatr.a * x + posmatr.c * y + posmatr.tx;
+					var y2:Number = posmatr.d * y + posmatr.b * x + posmatr.ty;
+					newposdata[(si + j)*2] = x2;
+					newposdata[(si + j)*2 + 1] = y2;
+					if(lastImageIsImage){
+						x = uvdata[j*2] as Number;
+						y = uvdata[j*2 + 1] as Number;
+						if (scaleWithImageUV){
+							x *=iw;
+							y *= ih;
+						}
+						if(uvmatr){
+							x2 = matrhelp.a * x + matrhelp.c * y + matrhelp.tx;
+							y2 = matrhelp.d * y + matrhelp.b * x + matrhelp.ty;
+							newuvdata[(si + j)*2] = x2;
+							newuvdata[(si + j)*2 + 1] = y2;
+						}else{
+							newuvdata[(si + j)*2] = x;
+							newuvdata[(si + j)*2 + 1] = y;
+						}
+					}
+					if(updateColor){
+						newcolordata[(si + j)] = color;//0xff0000ff// color[0];
+						//newcolordata[(si + j)*4+1] = color[1];
+						//newcolordata[(si + j)*4+2] = color[2];
+						//newcolordata[(si + j)*4+3] = color[3];
+					}
+				}
+				var did:Uint16Array = drawable2.index.data;
+				var didl:int = did.length;
+				for (j = 0; j < didl;j++){
+					var vi:int = did[j] as Number;
+					newidata[il + j] = vi + si;
+				}
+				si += len2;
+				il += didl;
+			}
+			newDrawable.index.dirty = true;
+			newDrawable.pos.dirty = true;
+			if(lastImageIsImage){
+				newDrawable.uv.dirty = true;
+			}
+			if(updateColor){
+				newDrawable.color.dirty = true;
+			}
+			renderImage(lastImage, newDrawable, null, null, false, false, lastImageIsImage);
+			batchsLen = 0;
+		}
+
+		/**
+		 * @flexjsignorecoercion flash.__native.GLCanvasPattern
+		 * @flexjsignorecoercion uint
+		 */
+		public function fill (/*opt_fillRule:String = ""*/) : Object {
+			if (fillStyleIsImage) {
+				var glcp:GLCanvasPattern = fillStyle as GLCanvasPattern;
+				drawImageInternal(glcp.image, currentPath.drawable,currentPath.matr,matr,false,colorTransform.tint,currentPath.path.tris.length>0,true);
+			}else if(currentPath){
+				drawImageInternal(fillStyle, currentPath.drawable,currentPath.matr,null,false,fillStyle as uint,false,false);
+			}
+			return null;
+		}
+
+		public function fillRect (x:Number, y:Number, w:Number, h:Number) : Object {
+			return null;
+		}
+
+		public function fillText (text:String, x:Number, y:Number/*, opt_maxWidth:Number = 0*/) : Object {
+			var image:HTMLCanvasElement = text2img[text];
+			if (image==null) {
+				image = text2img[text]=document.createElement("canvas") as HTMLCanvasElement;
+				var ctx:CanvasRenderingContext2D = image.getContext("2d") as CanvasRenderingContext2D;
+				ctx.font = font;
+				var measure:TextMetrics = ctx.measureText(text);
+				image.width = measure.width;
+				image.height = int(font.substr(0, font.indexOf("px")));
+				ctx.font = font;
+				ctx.textBaseline = "top";
+				ctx.fillStyle = fillStyle;
+				ctx.fillText(text, 0, 0);
+			}
+			matrhelp.copyFrom(matr);
+			matrhelp.translate(x, y);
+			drawImageInternal(image, bitmapDrawable,matrhelp.clone(),null,true,colorTransform.tint,true,true);
+			return null;
+		}
+
+		public function getImageData (sx:Number, sy:Number, sw:Number, sh:Number) : ImageData {
+			return null;
+		}
+
+		public function isPointInPath (x:Number, y:Number, opt_fillRule:String = "") : Boolean {
+			return false;
+		}
+
+		public function lineTo (x:Number, y:Number) : Object {
+			currentPath.path.lineTo(x, y);
+			return null;
+		}
+
+		public function measureText (text:String) : TextMetrics {
+			return null;
+		}
+
+		public function moveTo (x:Number, y:Number) : Object {
+			currentPath.path.moveTo(x, y);
+			return null;
+		}
+
+		public function putImageData (imagedata:ImageData, dx:Number, dy:Number, opt_dirtyX:Number = 0, opt_dirtyY:Number = 0, opt_dirtyWidth:Number = 0, opt_dirtyHeight:Number = 0) : Object {
+			return null;
+		}
+
+		public function quadraticCurveTo (cpx:Number, cpy:Number, x:Number, y:Number) : Object {
+			currentPath.path.curveTo(cpx, cpy, x, y);
+			return null;
+		}
+
+		public function rect (x:Number, y:Number, w:Number, h:Number) : Object {
+			currentPath.path.moveTo(x, y);
+			currentPath.path.lineTo(x + w, y);
+			currentPath.path.lineTo(x + w, y + h);
+			currentPath.path.lineTo(x, y + h);
+			currentPath.path.closePath();
+			return null;
+		}
+
+		/*public function restore () : Object {
+			var state:GLCanvasState = states[statesPos--];
+			matr.copyFrom(state.matr);
+			return null;
+		}
+
+		public function rotate (angle:Number) : Object {
+			matr.rotate(angle);
+			return null;
+		}
+
+		public function save () : Object {
+			var state:GLCanvasState = states[++statesPos];
+			if (state==null){
+				state = states[statesPos] = new GLCanvasState;
+			}
+			state.matr.copyFrom(matr);
+			return null;
+		}
+
+		public function scale (x:Number, y:Number) : Object {
+			matr.scale(x, y);
+			return null;
+		}
+		
+		public function translate (x:Number, y:Number) : Object {
+			matr.translate(x, y);
+			return null;
+		}*/
+
+		public function setTransform (m11:Number, m12:Number, m21:Number, m22:Number, dx:Number, dy:Number) : Object {
+			//matr.setTo(m11, m12, m21, m22, dx, dy);
+			return null;
+		}
+		public function setTransform2 (m:Matrix) : Object {
+			matr = m;// r.copyFrom(m);
+			return null;
+		}
+		public function stroke () : Object {
+			return null;
+		}
+
+		public function strokeRect (x:Number, y:Number, w:Number, h:Number) : Object {
+			return null;
+		}
+
+		public function strokeText (text:String, x:Number, y:Number, opt_maxWidth:Number = 0) : Object {
+			return null;
+		}
+
+		/*public function transform (m11:Number, m12:Number, m21:Number, m22:Number, dx:Number, dy:Number) : Object {
+			matrhelp.setTo(m11, m12, m21, m22, dx, dy);
+			matr.concat(matrhelp);
+			return null;
+		}*/
+		public function transform2 (m:Matrix) : Object {
+			var result_a:Number = matr.a / m.a;
+			var result_b:Number = 0.0;
+			var result_c:Number = 0.0;
+			var result_d:Number = matr.d / m.d;
+			var result_tx:Number = matr.tx / m.a + m.tx / m.a;
+			var result_ty:Number = matr.ty / m.d + m.ty / m.d;
+			if (matr.b != 0.0 || matr.c != 0.0 || m.b != 0.0 || m.c != 0.0)
+			{
+				result_a = result_a + matr.b * m.c;
+				result_d = result_d + matr.c * m.b;
+				result_b = result_b + (matr.a * m.b + matr.b * m.d);
+				result_c = result_c + (matr.c * m.a + matr.d * m.c);
+				result_tx = result_tx + matr.ty * m.c;
+				result_ty = result_ty + matr.tx * m.b;
+			}
+			m.a = result_a;
+			m.b = result_b;
+			m.c = result_c;
+			m.d = result_d;
+			m.tx = result_tx;
+			m.ty = result_ty;
+			matr = m;
+			return null;
+		}
+		
+		private function getTexture(img:Object):BitmapTexture {
+			var btexture:BitmapTexture = img._texture;
+			if (btexture == null) {
+				var w:int = getNextPow2(img.width);
+				var h:int = getNextPow2(img.height);
+				var bmd:BitmapData = new BitmapData(w, h, true, 0);
+				bmd.fromImage(img);
+				var texture:Texture = ctx.createTexture(w, h, Context3DTextureFormat.BGRA, false);
+				texture.uploadFromBitmapData(bmd,1);
+				btexture = new BitmapTexture;
+				btexture.img = img;
+				btexture.texture = texture;
+				btexture.width = w;
+				btexture.height = h;
+				img._texture = btexture;
+				//bmd2texture.set(img, btexture);
+			}
+			return btexture;
+		}
+		
+		private function getNextPow2(v:int):int {
+			var r:int = 1;
+			while (r < v) {
+				r *= 2;
+			}
+			return r;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b7a1d9f/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasState.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasState.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasState.as
new file mode 100644
index 0000000..b672641
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLCanvasState.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.__native 
+{
+	import flash.geom.Matrix;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class GLCanvasState 
+	{
+		public var matr:Matrix = new Matrix;
+		public function GLCanvasState() 
+		{
+			
+		}
+		
+	}
+
+}
\ 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/__native/GLDrawable.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLDrawable.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLDrawable.as
new file mode 100644
index 0000000..31817da
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLDrawable.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class GLDrawable 
+	{
+		public var pos:GLVertexBufferSet;
+		public var uv:GLVertexBufferSet;
+		private var _color:GLVertexBufferSet;
+		private var usage:Number;
+		public var index:GLIndexBufferSet;
+		public var numTriangles:int = -1
+		public function GLDrawable(posData:Float32Array,uvData:Float32Array,iData:Uint16Array,usage:Number) 
+		{
+			this.usage = usage;
+			pos = new GLVertexBufferSet(posData, 2,usage);
+			uv = new GLVertexBufferSet(uvData, 2,usage);
+			index = new GLIndexBufferSet(iData,usage);
+		}
+		
+		public function get color():GLVertexBufferSet 
+		{
+			if (_color==null||_color.data.length!=pos.data.length/2){
+				//_color = new GLVertexBufferSet(new Float32Array(pos.data.length * 2), 4, usage);
+				_color = new GLVertexBufferSet(new Uint32Array(pos.data.length /2), 4, usage);
+			}
+			return _color;
+		}
+		
+		public function set color(v:GLVertexBufferSet):void{
+			_color = v;
+		}
+	}
+
+}
\ 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/__native/GLGraphicsPath.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLGraphicsPath.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLGraphicsPath.as
new file mode 100644
index 0000000..9e008d6
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLGraphicsPath.as
@@ -0,0 +1,131 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	import flash.display.GraphicsPath;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class GLGraphicsPath extends GraphicsPath
+	{
+		public var polys:MemArray = new MemArray;
+		private var poly:MemArray;
+		public function GLGraphicsPath() 
+		{
+			
+		}
+		
+		override public function clear():void{
+			var len:int = polys.array.length;
+			for (var i:int = 0; i < len;i++ ){
+				polys.array[i].length = 0;
+			}
+			polys.length = 0;
+			tris.length = 0;
+		}
+		
+		override public function moveTo(x:Number, y:Number):void
+		{
+			makePoly();
+			//polys.push(makePoly());
+			poly.push(x);
+			poly.push(y);
+			//poly.push(x, y);
+		}
+		
+		override public function lineTo(x:Number, y:Number):void
+		{
+			if (poly==null){
+				makePoly();
+			}
+			//poly.push(x, y);
+			poly.push(x);
+			poly.push(y);
+		}
+		
+		override public function curveTo(controlX:Number, controlY:Number, anchorX:Number, anchorY:Number):void
+		{
+			if (poly==null){
+				makePoly();
+			}
+			poly.push(controlX);
+			poly.push(controlY);
+			poly.push(anchorX);
+			poly.push(anchorY);
+			//poly.push(controlX, controlY, anchorX, anchorY);
+		}
+		
+		override public function cubicCurveTo(controlX1:Number, controlY1:Number, controlX2:Number, controlY2:Number, anchorX:Number, anchorY:Number):void
+		{
+			if (poly==null){
+				makePoly();
+			}
+			poly.push(controlX1);
+			poly.push(controlY1);
+			poly.push(controlX2);
+			poly.push(controlY2);
+			poly.push(anchorX);
+			poly.push(anchorY);
+			//poly.push(controlX1, controlY1,controlX2, controlY2, anchorX, anchorY);
+		}
+		
+		override public function wideLineTo(x:Number, y:Number):void
+		{
+			lineTo(x, y);
+		}
+		
+		override public function wideMoveTo(x:Number, y:Number):void
+		{
+			moveTo(x, y);
+		}
+		
+		override public function arc(x:Number, y:Number,r:Number,a0:Number,a1:Number):void
+		{
+			var da:Number = Math.PI / 4;
+			var x0:Number = r;
+			var y0:Number = 0;
+			var sin:Number = Math.sin(da);
+			var cos:Number = Math.cos(da);
+			moveTo(x0+x, y0+y);
+			for (var a:Number = a0; a < a1;a+=da ){
+				var x_:Number = x0;
+				x0 = x0 * cos - y0 * sin;
+				y0 = x_ * sin + y0 * cos;
+				lineTo(x0 + x, y0 + y);
+			}
+		}
+		
+		private function rect (x:Number, y:Number, w:Number, h:Number) : void {
+			moveTo(x, y);
+			lineTo(x + w, y);
+			lineTo(x + w, y + h);
+			lineTo(x, y + h);
+		}
+		
+		private function makePoly():void {
+			poly = polys.array[polys.length];
+			if (poly==null){
+				poly = polys.array[polys.length] = new MemArray;
+			}
+			polys.length++;
+		}
+	}
+
+}
\ 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/__native/GLIndexBufferSet.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLIndexBufferSet.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLIndexBufferSet.as
new file mode 100644
index 0000000..36bcd10
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLIndexBufferSet.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.__native 
+{
+	import flash.display3D.Context3D;
+	import flash.display3D.IndexBuffer3D;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class GLIndexBufferSet 
+	{
+		private var buff:IndexBuffer3D
+		private var usage:Number;
+		public var dirty:Boolean = true;
+		public var data:Uint16Array;
+		public function GLIndexBufferSet(data:Uint16Array,usage:Number) 
+		{
+			this.usage = usage;
+			this.data = data;
+			
+		}
+		
+		public function getBuff(ctx:Context3D):IndexBuffer3D{
+			//if (dirty){
+			//var	buff:IndexBuffer3D = pool[data.length];
+			if(buff==null){
+				buff = ctx.createIndexBuffer(data.length);
+				buff.gl.bindBuffer(buff.gl.ELEMENT_ARRAY_BUFFER, buff.buff);
+				buff.gl.bufferData(buff.gl.ELEMENT_ARRAY_BUFFER, data, usage);
+				dirty = false;
+			}
+			if(dirty){
+				buff.gl.bindBuffer(buff.gl.ELEMENT_ARRAY_BUFFER, buff.buff);
+				buff.gl.bufferSubData(buff.gl.ELEMENT_ARRAY_BUFFER,0, data);
+				dirty = false;
+			}
+			//buff.uploadFromVector(Vector.<uint>(data), 0, data.length);
+			
+			return buff;
+		}
+	}
+
+}
\ 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/__native/GLPath2D.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLPath2D.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLPath2D.as
new file mode 100644
index 0000000..5bbdce0
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLPath2D.as
@@ -0,0 +1,130 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	import flash.display.GraphicsPath;
+	import flash.display.GraphicsPathCommand;
+	import flash.geom.Matrix;
+	/**
+	 * ...
+	 * @author lizhi http://matrix3d.github.io/
+	 */
+	public class GLPath2D 
+	{
+		public var matr:Matrix = new Matrix;
+		public var _drawable:GLDrawable;
+		private var pos:Float32Array;
+		private var uv:Float32Array;
+		private var index:Uint16Array;
+		public var path:GLGraphicsPath;
+		public function GLPath2D() 
+		{
+			
+		}
+		
+		public function get drawable():GLDrawable{
+			if (path.gpuPath2DDirty){
+				path.gpuPath2DDirty = false;
+				
+				var polys:MemArray = path.polys;
+				
+				var nump:int = 0;
+				var numi:int = 0;
+				var len:int = path.polys.length as Number;
+				for (var i:int = 0; i < len;i++ ){
+					var plen:int = path.polys.array[i].length as Number;
+					nump += plen;
+					if(plen>=6){
+						numi += (plen / 2 - 2) * 3;
+					}
+				}
+				var tlen:int = path.tris.length;
+				var diffuv:Boolean = false;
+				for (i = 0; i < tlen;i++ ){
+					var tri:Array = path.tris[i];
+					nump += tri[0].length as Number;
+					numi += tri[1].length as Number;
+					if (tri[2]){
+						diffuv = true;
+					}
+				}
+				if(pos==null||pos.length!=nump){
+					pos = new Float32Array(nump);
+				}
+				if(index==null||index.length!=numi){
+					index = new Uint16Array(numi);
+				}
+				if(diffuv&&(uv==null||uv.length!=nump)){
+					uv = new Float32Array(nump);
+				}
+				var offset:int = 0;
+				var pi:int = 0;
+				var ii:int = 0;
+				for (i = 0; i < len; i++ ){
+					var poly:MemArray = polys.array[i];
+					plen = poly.length;
+					var plendiv2:int = plen / 2;
+					for (var j:int = 0; j < plendiv2; j++ ){
+						var x:Number = poly.array[2 * j] as Number;
+						var y:Number = poly.array[2 * j + 1] as Number;
+						pos[pi++] = x;
+						pos[pi++] = y;
+						if (j>=2){
+							index[ii++] = offset;
+							index[ii++] = offset+j-1;
+							index[ii++] = offset+j;
+						}
+					}
+					offset += j;
+				}
+				
+				for (i = 0; i < tlen;i++ ){
+					tri = path.tris[i];
+					var vsdata:Vector.<Number> = tri[0];
+					var idata:Vector.<int> = tri[1];
+					var uvdata:Vector.<Number> = tri[2];
+					var len2:int = vsdata.length as Number;
+					for (j = 0; j < len2;j++ ){
+						pos[pi] = vsdata[j];
+						if(uvdata)
+						uv[pi] = uvdata[j];
+						pi++;
+					}
+					len2 = idata.length as Number;
+					for (j = 0; j < len2;j++ ){
+						index[ii++] = offset + idata[j];
+					}
+					offset += vsdata.length / 2;
+				}
+				if(_drawable==null){
+					_drawable = new GLDrawable(pos, pos, index,WebGLRenderingContext.STATIC_DRAW);
+				}else{
+					_drawable.pos.data = pos;
+					_drawable.uv.data = diffuv?uv:pos;
+					_drawable.index.data = index;
+					_drawable.pos.dirty = true;
+					_drawable.uv.dirty = true;
+					_drawable.index.dirty = true;
+				}
+			}
+			return _drawable;
+		}
+	}
+
+}
\ 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/__native/GLVertexBufferSet.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLVertexBufferSet.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLVertexBufferSet.as
new file mode 100644
index 0000000..d806441
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/GLVertexBufferSet.as
@@ -0,0 +1,57 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	import flash.display3D.Context3D;
+	import flash.display3D.VertexBuffer3D;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class GLVertexBufferSet 
+	{
+		public var data:Object;
+		public var data32PerVertex:int;
+		private var buff:VertexBuffer3D;
+		private var usage:Number;
+		public var dirty:Boolean = true;
+		public function GLVertexBufferSet(data:Object,data32PerVertex:int,usage:Number) 
+		{
+			this.usage = usage;
+			this.data32PerVertex = data32PerVertex;
+			this.data = data;
+		}
+		
+		public function getBuff(ctx:Context3D):VertexBuffer3D{
+			if (buff==null){
+				buff= ctx.createVertexBuffer(data.length / data32PerVertex, data32PerVertex);
+				buff.gl.bindBuffer(buff.gl.ARRAY_BUFFER, buff.buff);
+				buff.gl.bufferData(buff.gl.ARRAY_BUFFER, data, usage);
+				dirty = false;
+			}
+			if (dirty){
+				buff.gl.bindBuffer(buff.gl.ARRAY_BUFFER, buff.buff);
+				buff.gl.bufferSubData(buff.gl.ARRAY_BUFFER, 0, data);
+				dirty = false;
+			}
+			return buff;
+		}
+	}
+
+}
\ 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/__native/IRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/IRenderer.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/IRenderer.as
new file mode 100644
index 0000000..f2e7cab
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/IRenderer.as
@@ -0,0 +1,67 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	import flash.display.BitmapData;
+	import flash.display.Graphics;
+	import flash.display.GraphicsPath;
+	import flash.geom.ColorTransform;
+	import flash.geom.Matrix;
+	import flash.text.TextFormat;
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class IRenderer 
+	{
+		
+		public function IRenderer() 
+		{
+			
+		}
+		
+		public function createPath():GraphicsPath{
+			return null;
+		}
+		
+		public function getCssColor(color:uint,alpha:Number,ct:ColorTransform,toarr:Array):Object{
+			return null;
+		}
+		
+		public function renderGraphics(ctx:CanvasRenderingContext2D,g:Graphics,m:Matrix,blendMode:String,colorTransform:ColorTransform):void{
+			
+		}
+		
+		public function renderImage(ctx:CanvasRenderingContext2D,img:BitmapData,m:Matrix,blendMode:String,colorTransform:ColorTransform):void{
+			
+		}
+		
+		public function renderText(ctx:CanvasRenderingContext2D,txt:String,textFormat:TextFormat, m:Matrix, blendMode:String, colorTransform:ColorTransform,x:Number,y:Number):void{
+			
+		}
+		
+		public function finish(ctx:CanvasRenderingContext2D):void{
+			
+		}
+		public function start(ctx:CanvasRenderingContext2D):void{
+			
+		}
+	}
+
+}
\ 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/__native/MemArray.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/MemArray.as b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/MemArray.as
new file mode 100644
index 0000000..d6da61a
--- /dev/null
+++ b/frameworks/projects/spriteflexjs/src/main/flex/flash/__native/MemArray.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.__native 
+{
+	/**
+	 * ...
+	 * @author lizhi
+	 */
+	public class MemArray 
+	{
+		public var array:Array = [];
+		public var length:int = 0;
+		public function MemArray() 
+		{
+			
+		}
+		
+		public function push(v:Object):void{
+			array[length++] = v;
+		}
+	}
+
+}
\ No newline at end of file


Mime
View raw message