You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by ps...@apache.org on 2010/11/30 16:54:20 UTC

svn commit: r1040591 - in /incubator/wookie/trunk/widgets/butterfly: index.html legal/flashcanvas_licence.txt scripts/butterfly.js scripts/flashcanvas.js scripts/flashcanvas.swf

Author: psharples
Date: Tue Nov 30 15:54:20 2010
New Revision: 1040591

URL: http://svn.apache.org/viewvc?rev=1040591&view=rev
Log:
Updated so widget now uses flashcanvas to render canvas  in Internet Explorer. See WOOKIE-158

Added:
    incubator/wookie/trunk/widgets/butterfly/legal/flashcanvas_licence.txt   (with props)
    incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.js   (with props)
    incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.swf   (with props)
Modified:
    incubator/wookie/trunk/widgets/butterfly/index.html
    incubator/wookie/trunk/widgets/butterfly/scripts/butterfly.js

Modified: incubator/wookie/trunk/widgets/butterfly/index.html
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/butterfly/index.html?rev=1040591&r1=1040590&r2=1040591&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/butterfly/index.html (original)
+++ incubator/wookie/trunk/widgets/butterfly/index.html Tue Nov 30 15:54:20 2010
@@ -48,6 +48,7 @@
         cursor: pointer;
       }
     --></style>
+    	<!--[if lt IE 9]><script type="text/javascript" src="scripts/flashcanvas.js"></script><![endif]-->
         <script type="text/javascript" src="scripts/butterfly.js"></script>
   </head>
   <body onload="Controller.init()">

Added: incubator/wookie/trunk/widgets/butterfly/legal/flashcanvas_licence.txt
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/butterfly/legal/flashcanvas_licence.txt?rev=1040591&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/butterfly/legal/flashcanvas_licence.txt (added)
+++ incubator/wookie/trunk/widgets/butterfly/legal/flashcanvas_licence.txt Tue Nov 30 15:54:20 2010
@@ -0,0 +1,24 @@
+The MIT License
+
+Copyright (c) 2009-2010 FlashCanvas Project:
+
+ * Tim Cameron Ryan
+ * Shinya Muramatsu
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.

Propchange: incubator/wookie/trunk/widgets/butterfly/legal/flashcanvas_licence.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/wookie/trunk/widgets/butterfly/scripts/butterfly.js
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/butterfly/scripts/butterfly.js?rev=1040591&r1=1040590&r2=1040591&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/butterfly/scripts/butterfly.js (original)
+++ incubator/wookie/trunk/widgets/butterfly/scripts/butterfly.js Tue Nov 30 15:54:20 2010
@@ -1,208 +1,282 @@
-/*
- * 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.
- */
-var canvas, context, tool;
-  
-var Controller = {
-
-    red: 255,
-    green: 255,
-    blue: 64,
-    
-    setRGB: function(r,g,b){
-        this.red=r;this.green=g;this.blue=b;
-    },
-    
-    fill: function(){
-        context.fillStyle = "rgb("+this.red+","+this.green+","+this.blue+")";
-    	context.fillRect(0,0,400,300);
-    },
-
-    init: function(){
-        init_canvas();
-    }
-}
-
-function init_canvas () {
-    // Find the canvas element.
-    canvas = document.getElementById('imageView');
-    if (!canvas) {
-      alert('Error: I cannot find the canvas element!');
-      return;
-    }
-
-    if (!canvas.getContext) {
-      alert('Error: no canvas.getContext!');
-      return;
-    }
-    
-    canvas.style.cursor="crosshair";
-
-    // Get the 2D canvas context.
-    context = canvas.getContext('2d');
-    if (!context) {
-      alert('Error: failed to getContext!');
-      return;
-    }
-
-    // Pencil tool instance.
-    tool = new tool_pencil();
-    
-    // Mask
-    mask();
-
-    // Attach the mousedown, mousemove and mouseup event listeners.
-    canvas.addEventListener('mousedown', ev_canvas, false);
-    canvas.addEventListener('mousemove', ev_canvas, false);
-    canvas.addEventListener('mouseup',   ev_canvas, false);
-  }
-
-  // This painting tool works like a drawing pencil which tracks the mouse 
-  // movements.
-  function tool_pencil () {
-    context.lineWidth = 4;
-    var tool = this;
-    this.started = false;
-
-    // This is called when you start holding down the mouse button.
-    // This starts the pencil drawing.
-    this.mousedown = function (ev) {
-        tool.started = true;
-    };
-
-    // This function is called every time you move the mouse. Obviously, it only 
-    // draws if the tool.started state is set to true (when you are holding down 
-    // the mouse button).
-    this.mousemove = function (ev) {
-      if (tool.started) {
-        // Mirroring
-            brush(ev._x,ev._y);
-            brush(400-ev._x,ev._y);
-      }
-    };
-
-    // This is called when you release the mouse button.
-    this.mouseup = function (ev) {
-      if (tool.started) {
-        tool.mousemove(ev);
-        tool.started = false;
-      }
-    };
-  }
-
-  // The general-purpose event handler. This function just determines the mouse 
-  // position relative to the canvas element.
-  function ev_canvas (ev) {
-    if (ev.layerX || ev.layerX == 0) { // Firefox
-      ev._x = ev.layerX;
-      ev._y = ev.layerY;
-    } else if (ev.offsetX || ev.offsetX == 0) { // Opera
-      ev._x = ev.offsetX;
-      ev._y = ev.offsetY;
-    }
-
-    // Call the event handler of the tool.
-    var func = tool[ev.type];
-    if (func) {
-      func(ev);
-    }
-  }
-  
-  
-brush = function (x,y) {
-		var c = context,
-			D = 15,
-			D2 = D * 2;
-            hardness = 30;
-            opacity = 60;
-		c.globalCompositeOperation = 'source-over';
-		var r = c.createRadialGradient(x, y, hardness / 100 * D - 1, x, y, D);
-		r.addColorStop(0, 'rgba('+Controller.red+','+Controller.green+','+Controller.blue+',' + opacity / 100 + ')');
-		r.addColorStop(0.95, 'rgba('+Controller.red+','+Controller.green+','+Controller.blue+',0)'); // prevent aggregation of semi-opaque pixels
-		r.addColorStop(1, 'rgba('+Controller.red+','+Controller.green+','+Controller.blue+',0)');
-		c.fillStyle = r;
-		c.fillRect(x-D, y-D, D2, D2);
-		c.globalCompositeOperation = 'source-in';
-		c.rect(x-D, y-D, D2, D2);
-};
-
-mask = function(){
-    context.save();
-    context.beginPath();
-    context.translate(400,300); 
-    context.rotate(Math.PI);
-    context.moveTo(0,300);
-    context.bezierCurveTo(80.1783,301.0774,134.5506,273.2636,168.0000,228.0000);
-    context.bezierCurveTo(174.6660,215.3346,181.3340,202.6654,188.0000,190.0000);
-    context.bezierCurveTo(189.3332,194.9995,190.6668,200.0005,192.0000,205.0000);
-    context.bezierCurveTo(171.6442,233.3266,148.4269,261.6911,134.0000,295.0000);
-    context.bezierCurveTo(134.3333,295.6666,134.6667,296.3334,135.0000,297.0000);
-    context.bezierCurveTo(154.8897,289.3127,174.1114,208.2397,205.0000,207.0000);
-    context.bezierCurveTo(206.9998,208.6665,209.0002,210.3335,211.0000,212.0000);
-    context.bezierCurveTo(213.8325,219.3365,262.2242,296.0280,265.0000,297.0000);
-    context.bezierCurveTo(265.3333,296.3334,265.6667,295.6666,266.0000,295.0000);
-    context.bezierCurveTo(253.2034,263.5240,229.7223,229.2060,208.0000,205.0000);
-    context.bezierCurveTo(209.3332,199.6672,210.6668,194.3328,212.0000,189.0000);
-    context.bezierCurveTo(212.3333,189.0000,212.6667,189.0000,213.0000,189.0000);
-    context.bezierCurveTo(213.3333,189.0000,213.6667,189.0000,214.0000,189.0000);
-    context.bezierCurveTo(235.4263,260.3326,305.6072,300.4202,400.0000,300.0000);
-    context.bezierCurveTo(400.7564,260.7574,381.7836,251.4776,376.0000,221.0000);
-    context.bezierCurveTo(372.5464,202.8009,374.9546,182.1234,363.0000,173.0000);
-    context.bezierCurveTo(352.5150,164.9982,339.5687,168.3028,325.0000,163.0000);
-    context.bezierCurveTo(325.0000,162.6667,325.0000,162.3333,325.0000,162.0000);
-    context.bezierCurveTo(349.5033,158.3783,352.2077,130.7042,354.0000,109.0000);
-    context.bezierCurveTo(345.9678,103.6550,343.8264,100.1513,338.0000,94.0000);
-    context.bezierCurveTo(339.8800,86.6748,343.8295,83.7354,341.0000,77.0000);
-    context.bezierCurveTo(336.3338,73.6670,331.6662,70.3330,327.0000,67.0000);
-    context.bezierCurveTo(311.5394,39.7644,355.2383,26.7068,341.0000,2.0000);
-    context.bezierCurveTo(337.2354,0.8094,333.2949,-0.8581,329.0000,1.0000);
-    context.bezierCurveTo(327.6668,1.6666,326.3332,2.3334,325.0000,3.0000);
-    context.bezierCurveTo(321.9745,19.4608,323.1224,37.2860,309.0000,43.0000);
-    context.bezierCurveTo(294.2036,46.5382,273.9450,34.5515,258.0000,41.0000);
-    context.bezierCurveTo(230.1233,52.2740,223.0465,111.1756,212.0000,141.0000);
-    context.bezierCurveTo(211.3334,141.0000,210.6666,141.0000,210.0000,141.0000);
-    context.bezierCurveTo(208.6668,130.3344,207.3332,119.6656,206.0000,109.0000);
-    context.bezierCurveTo(204.0002,107.6668,201.9998,106.3332,200.0000,105.0000);
-    context.bezierCurveTo(198.0002,105.9999,195.9998,107.0001,194.0000,108.0000);
-    context.bezierCurveTo(192.0002,118.6656,189.9998,129.3344,188.0000,140.0000);
-    context.bezierCurveTo(188.0000,139.3334,188.0000,138.6666,188.0000,138.0000);
-    context.bezierCurveTo(181.3340,119.3352,174.6660,100.6648,168.0000,82.0000);
-    context.bezierCurveTo(166.3335,73.6675,164.6665,65.3325,163.0000,57.0000);
-    context.bezierCurveTo(159.6670,55.0002,156.3330,52.9998,153.0000,51.0000);
-    context.bezierCurveTo(124.5349,29.4373,115.4563,53.0338,91.0000,43.0000);
-    context.bezierCurveTo(75.6567,36.7051,77.4912,12.9952,69.0000,0.0000);
-    context.bezierCurveTo(65.3654,0.6436,65.9730,0.4032,64.0000,2.0000);
-    context.bezierCurveTo(59.0478,4.2801,58.0846,6.9206,56.0000,12.0000);
-    context.bezierCurveTo(58.5748,31.4614,74.0400,36.2547,75.0000,60.0000);
-    context.bezierCurveTo(70.0342,69.9436,61.4112,73.0454,56.0000,82.0000);
-    context.bezierCurveTo(58.6524,86.5103,60.9126,87.5516,62.0000,94.0000);
-    context.bezierCurveTo(58.7903,95.8190,48.1997,106.9635,45.0000,111.0000);
-    context.bezierCurveTo(51.2644,140.5583,50.9489,147.1374,74.0000,163.0000);
-    context.bezierCurveTo(62.8643,167.3318,49.5220,163.8747,41.0000,170.0000);
-    context.bezierCurveTo(25.0144,181.4898,28.4368,204.3249,23.0000,226.0000);
-    context.bezierCurveTo(16.0797,253.5891,-0.2461,262.3976,0.0000,300.0000);
-    context.closePath();
-    context.stroke();
-    context.restore();
-    context.clip();
-    context.fillStyle = "rgb(255,255,255)";
-    context.fill();
-}
-
-
-
+/*
+ * 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.
+ */
+var canvas, context, tool;
+  
+var Controller = {
+
+    red: 255,
+    green: 255,
+    blue: 64,
+    
+    setRGB: function(r,g,b){
+        this.red=r;this.green=g;this.blue=b;
+    },
+    
+    fill: function(){
+        context.fillStyle = "rgb("+this.red+","+this.green+","+this.blue+")";
+    	context.fillRect(0,0,400,300);
+    },
+
+    init: function(){
+        init_canvas();
+    }
+}
+
+function init_canvas () {
+ 
+    // Find the canvas element.
+    canvas = document.getElementById('imageView');
+    if (!canvas) {
+      alert('Error: I cannot find the canvas element!');
+      return;
+    }
+
+    if (!canvas.getContext) {
+      alert('Error: no canvas.getContext!');
+      return;
+    }
+    
+    canvas.style.cursor="crosshair";
+
+    // Get the 2D canvas context.
+    context = canvas.getContext('2d');
+    if (!context) {
+      alert('Error: failed to getContext!');
+      return;
+    }
+
+    // Pencil tool instance.
+    tool = new tool_pencil();
+    
+    // Mask
+    mask();
+    // If IE
+	if (canvas.attachEvent) {
+    	canvas.attachEvent("onmousedown", ev_canvas, false);
+	    canvas.attachEvent('onmousemove', ev_canvas, false);
+	    canvas.attachEvent('onmouseup',   ev_canvas, false);	
+	}
+	 else if (canvas.addEventListener) { 
+    	// Attach the mousedown, mousemove and mouseup event listeners.
+	    canvas.addEventListener('mousedown', ev_canvas, false);
+    	canvas.addEventListener('mousemove', ev_canvas, false);
+	    canvas.addEventListener('mouseup',   ev_canvas, false);
+    }
+
+  }
+ 
+
+  // This painting tool works like a drawing pencil which tracks the mouse 
+  // movements.
+  function tool_pencil () {
+    context.lineWidth = 4;
+    var tool = this;
+    this.started = false;
+
+    // This is called when you start holding down the mouse button.
+    // This starts the pencil drawing.
+    this.mousedown = function (ev) {    
+        tool.started = true;
+    };
+
+    // This function is called every time you move the mouse. Obviously, it only 
+    // draws if the tool.started state is set to true (when you are holding down 
+    // the mouse button).
+    this.mousemove = function (ev) {
+      if (tool.started) {
+        // Mirroring
+            brush(ev._x,ev._y);
+            brush(400-ev._x,ev._y);
+      }
+    };
+
+    // This is called when you release the mouse button.
+    this.mouseup = function (ev) {
+      if (tool.started) {
+        tool.mousemove(ev);
+        tool.started = false;
+      }
+    };
+  }
+
+  // The general-purpose event handler. This function just determines the mouse 
+  // position relative to the canvas element.
+  function ev_canvas (ev) {
+    if (ev.layerX || ev.layerX == 0) { // Firefox
+      ev._x = ev.layerX;
+      ev._y = ev.layerY;
+    } 
+    else if (ev.offsetX || ev.offsetX == 0) { // Opera    
+      ev._x = ev.offsetX;
+      ev._y = ev.offsetY;
+    }
+
+    // Call the event handler of the tool.
+    var func = tool[ev.type];
+    if (func) {
+      func(ev);
+    }
+  }
+  
+  
+brush = function (x,y) {
+		var c = context,
+			D = 15,
+			D2 = D * 2;
+            hardness = 30;
+            opacity = 60;
+          /*  
+            // add this for IE
+            if (canvas.attachEvent) {
+            	D = 8;
+            	D2 = D * 2;
+            }
+           */ 
+		c.globalCompositeOperation = 'source-over';
+		var r = c.createRadialGradient(x, y, hardness / 100 * D - 1, x, y, D);
+		r.addColorStop(0, 'rgba('+Controller.red+','+Controller.green+','+Controller.blue+',' + opacity / 100 + ')');
+		r.addColorStop(0.95, 'rgba('+Controller.red+','+Controller.green+','+Controller.blue+',0)'); // prevent aggregation of semi-opaque pixels
+		r.addColorStop(1, 'rgba('+Controller.red+','+Controller.green+','+Controller.blue+',0)');
+		c.fillStyle = r;
+		c.fillRect(x-D, y-D, D2, D2);
+		c.globalCompositeOperation = 'source-in';
+		c.rect(x-D, y-D, D2, D2);
+};
+
+mask = function(){
+	// the butterfly shape
+    context.save();
+    context.beginPath();
+    context.translate(400,300); 
+    context.rotate(Math.PI);
+    context.moveTo(0,300);
+    // if IE - TODO butterfly image is not quite drawn correctly
+    if (canvas.attachEvent) {
+    	context.quadraticCurveTo(80.1783,301.0774,134.5506,273.2636,168.0000,228.0000);
+    	context.quadraticCurveTo(174.6660,215.3346,181.3340,202.6654,188.0000,190.0000);
+    	context.quadraticCurveTo(189.3332,194.9995,190.6668,200.0005,192.0000,205.0000);    
+    	context.quadraticCurveTo(171.6442,233.3266,148.4269,261.6911,134.0000,295.0000);
+    	context.quadraticCurveTo(134.3333,295.6666,134.6667,296.3334,135.0000,297.0000);
+    	context.quadraticCurveTo(154.8897,289.3127,174.1114,208.2397,205.0000,207.0000);
+    	context.quadraticCurveTo(206.9998,208.6665,209.0002,210.3335,211.0000,212.0000);
+    	context.quadraticCurveTo(213.8325,219.3365,262.2242,296.0280,265.0000,297.0000);
+    	context.quadraticCurveTo(265.3333,296.3334,265.6667,295.6666,266.0000,295.0000);
+    	context.quadraticCurveTo(253.2034,263.5240,229.7223,229.2060,208.0000,205.0000);
+    	context.quadraticCurveTo(209.3332,199.6672,210.6668,194.3328,212.0000,189.0000);
+    	context.quadraticCurveTo(212.3333,189.0000,212.6667,189.0000,213.0000,189.0000);
+    	context.quadraticCurveTo(213.3333,189.0000,213.6667,189.0000,214.0000,189.0000);
+    	context.quadraticCurveTo(235.4263,260.3326,305.6072,300.4202,400.0000,300.0000);
+    	context.quadraticCurveTo(400.7564,260.7574,381.7836,251.4776,376.0000,221.0000);
+    	context.quadraticCurveTo(372.5464,202.8009,374.9546,182.1234,363.0000,173.0000);
+    	context.quadraticCurveTo(352.5150,164.9982,339.5687,168.3028,325.0000,163.0000);
+    	context.quadraticCurveTo(325.0000,162.6667,325.0000,162.3333,325.0000,162.0000);
+    	context.quadraticCurveTo(349.5033,158.3783,352.2077,130.7042,354.0000,109.0000);
+    	context.quadraticCurveTo(345.9678,103.6550,343.8264,100.1513,338.0000,94.0000);
+    	context.quadraticCurveTo(339.8800,86.6748,343.8295,83.7354,341.0000,77.0000);
+    	context.quadraticCurveTo(336.3338,73.6670,331.6662,70.3330,327.0000,67.0000);
+    	context.quadraticCurveTo(311.5394,39.7644,355.2383,26.7068,341.0000,2.0000);
+    	context.quadraticCurveTo(337.2354,0.8094,333.2949,-0.8581,329.0000,1.0000);
+    	context.quadraticCurveTo(327.6668,1.6666,326.3332,2.3334,325.0000,3.0000);
+    	context.quadraticCurveTo(321.9745,19.4608,323.1224,37.2860,309.0000,43.0000);
+    	context.quadraticCurveTo(294.2036,46.5382,273.9450,34.5515,258.0000,41.0000);
+    	context.quadraticCurveTo(230.1233,52.2740,223.0465,111.1756,212.0000,141.0000);
+    	context.quadraticCurveTo(211.3334,141.0000,210.6666,141.0000,210.0000,141.0000);
+    	context.quadraticCurveTo(208.6668,130.3344,207.3332,119.6656,206.0000,109.0000);
+    	context.quadraticCurveTo(204.0002,107.6668,201.9998,106.3332,200.0000,105.0000);
+    	context.quadraticCurveTo(198.0002,105.9999,195.9998,107.0001,194.0000,108.0000);
+    	context.quadraticCurveTo(192.0002,118.6656,189.9998,129.3344,188.0000,140.0000);
+    	context.quadraticCurveTo(188.0000,139.3334,188.0000,138.6666,188.0000,138.0000);
+    	context.quadraticCurveTo(181.3340,119.3352,174.6660,100.6648,168.0000,82.0000);
+    	context.quadraticCurveTo(166.3335,73.6675,164.6665,65.3325,163.0000,57.0000);
+    	context.quadraticCurveTo(159.6670,55.0002,156.3330,52.9998,153.0000,51.0000);
+    	context.quadraticCurveTo(124.5349,29.4373,115.4563,53.0338,91.0000,43.0000);
+    	context.quadraticCurveTo(75.6567,36.7051,77.4912,12.9952,69.0000,0.0000);
+    	context.quadraticCurveTo(65.3654,0.6436,65.9730,0.4032,64.0000,2.0000);
+    	context.quadraticCurveTo(59.0478,4.2801,58.0846,6.9206,56.0000,12.0000);
+    	context.quadraticCurveTo(58.5748,31.4614,74.0400,36.2547,75.0000,60.0000);
+    	context.quadraticCurveTo(70.0342,69.9436,61.4112,73.0454,56.0000,82.0000);
+    	context.quadraticCurveTo(58.6524,86.5103,60.9126,87.5516,62.0000,94.0000);
+    	context.quadraticCurveTo(58.7903,95.8190,48.1997,106.9635,45.0000,111.0000);
+    	context.quadraticCurveTo(51.2644,140.5583,50.9489,147.1374,74.0000,163.0000);
+    	context.quadraticCurveTo(62.8643,167.3318,49.5220,163.8747,41.0000,170.0000);
+    	context.quadraticCurveTo(25.0144,181.4898,28.4368,204.3249,23.0000,226.0000);
+    	context.quadraticCurveTo(16.0797,253.5891,-0.2461,262.3976,0.0000,300.0000);
+   	}
+   	else{
+   		// IE8 took too long to process this...
+   		context.bezierCurveTo(80.1783,301.0774,134.5506,273.2636,168.0000,228.0000);
+   		context.bezierCurveTo(174.6660,215.3346,181.3340,202.6654,188.0000,190.0000);
+   		context.bezierCurveTo(189.3332,194.9995,190.6668,200.0005,192.0000,205.0000);    
+   		context.bezierCurveTo(171.6442,233.3266,148.4269,261.6911,134.0000,295.0000);
+   		context.bezierCurveTo(134.3333,295.6666,134.6667,296.3334,135.0000,297.0000);
+   		context.bezierCurveTo(154.8897,289.3127,174.1114,208.2397,205.0000,207.0000);
+   		context.bezierCurveTo(206.9998,208.6665,209.0002,210.3335,211.0000,212.0000);
+   		context.bezierCurveTo(213.8325,219.3365,262.2242,296.0280,265.0000,297.0000);
+   		context.bezierCurveTo(265.3333,296.3334,265.6667,295.6666,266.0000,295.0000);
+   		context.bezierCurveTo(253.2034,263.5240,229.7223,229.2060,208.0000,205.0000);
+   		context.bezierCurveTo(209.3332,199.6672,210.6668,194.3328,212.0000,189.0000);
+   		context.bezierCurveTo(212.3333,189.0000,212.6667,189.0000,213.0000,189.0000);
+   		context.bezierCurveTo(213.3333,189.0000,213.6667,189.0000,214.0000,189.0000);
+   		context.bezierCurveTo(235.4263,260.3326,305.6072,300.4202,400.0000,300.0000);
+   		context.bezierCurveTo(400.7564,260.7574,381.7836,251.4776,376.0000,221.0000);
+   		context.bezierCurveTo(372.5464,202.8009,374.9546,182.1234,363.0000,173.0000);
+   		context.bezierCurveTo(352.5150,164.9982,339.5687,168.3028,325.0000,163.0000);
+   		context.bezierCurveTo(325.0000,162.6667,325.0000,162.3333,325.0000,162.0000);
+   		context.bezierCurveTo(349.5033,158.3783,352.2077,130.7042,354.0000,109.0000);
+   		context.bezierCurveTo(345.9678,103.6550,343.8264,100.1513,338.0000,94.0000);
+   		context.bezierCurveTo(339.8800,86.6748,343.8295,83.7354,341.0000,77.0000);
+   		context.bezierCurveTo(336.3338,73.6670,331.6662,70.3330,327.0000,67.0000);
+   		context.bezierCurveTo(311.5394,39.7644,355.2383,26.7068,341.0000,2.0000);
+   		context.bezierCurveTo(337.2354,0.8094,333.2949,-0.8581,329.0000,1.0000);
+   		context.bezierCurveTo(327.6668,1.6666,326.3332,2.3334,325.0000,3.0000);
+   		context.bezierCurveTo(321.9745,19.4608,323.1224,37.2860,309.0000,43.0000);
+   		context.bezierCurveTo(294.2036,46.5382,273.9450,34.5515,258.0000,41.0000);
+   		context.bezierCurveTo(230.1233,52.2740,223.0465,111.1756,212.0000,141.0000);
+   		context.bezierCurveTo(211.3334,141.0000,210.6666,141.0000,210.0000,141.0000);
+   		context.bezierCurveTo(208.6668,130.3344,207.3332,119.6656,206.0000,109.0000);
+   		context.bezierCurveTo(204.0002,107.6668,201.9998,106.3332,200.0000,105.0000);
+   		context.bezierCurveTo(198.0002,105.9999,195.9998,107.0001,194.0000,108.0000);
+   		context.bezierCurveTo(192.0002,118.6656,189.9998,129.3344,188.0000,140.0000);
+   		context.bezierCurveTo(188.0000,139.3334,188.0000,138.6666,188.0000,138.0000);
+   		context.bezierCurveTo(181.3340,119.3352,174.6660,100.6648,168.0000,82.0000);
+   		context.bezierCurveTo(166.3335,73.6675,164.6665,65.3325,163.0000,57.0000);
+   		context.bezierCurveTo(159.6670,55.0002,156.3330,52.9998,153.0000,51.0000);
+   		context.bezierCurveTo(124.5349,29.4373,115.4563,53.0338,91.0000,43.0000);
+   		context.bezierCurveTo(75.6567,36.7051,77.4912,12.9952,69.0000,0.0000);
+   		context.bezierCurveTo(65.3654,0.6436,65.9730,0.4032,64.0000,2.0000);
+   		context.bezierCurveTo(59.0478,4.2801,58.0846,6.9206,56.0000,12.0000);
+   		context.bezierCurveTo(58.5748,31.4614,74.0400,36.2547,75.0000,60.0000);
+   		context.bezierCurveTo(70.0342,69.9436,61.4112,73.0454,56.0000,82.0000);
+   		context.bezierCurveTo(58.6524,86.5103,60.9126,87.5516,62.0000,94.0000);
+   		context.bezierCurveTo(58.7903,95.8190,48.1997,106.9635,45.0000,111.0000);
+   		context.bezierCurveTo(51.2644,140.5583,50.9489,147.1374,74.0000,163.0000);
+   		context.bezierCurveTo(62.8643,167.3318,49.5220,163.8747,41.0000,170.0000);
+   		context.bezierCurveTo(25.0144,181.4898,28.4368,204.3249,23.0000,226.0000);
+   		context.bezierCurveTo(16.0797,253.5891,-0.2461,262.3976,0.0000,300.0000);
+   	}           
+    context.closePath();
+    context.stroke();
+    context.restore();
+    context.clip();
+    context.fillStyle = "rgb(255,255,255)";
+    context.fill();        
+}
+
+
+

Added: incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.js
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.js?rev=1040591&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.js (added)
+++ incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.js Tue Nov 30 15:54:20 2010
@@ -0,0 +1,26 @@
+/*
+ * FlashCanvas
+ *
+ * Copyright (c) 2009      Tim Cameron Ryan
+ * Copyright (c) 2009-2010 FlashCanvas Project
+ * Released under the MIT/X License
+ */
+window.ActiveXObject&&!window.CanvasRenderingContext2D&&function(h,i){function P(a){this.width=a}function y(a){this.id=a.C++}function p(a){this.G=a;this.id=a.C++}function q(a,b){this.canvas=a;this.B=b;this.d=a.uniqueID;this.D();this.C=0;this.t="";var c=this;setInterval(function(){l[c.d]===0&&c.e()},30)}function z(){if(i.readyState==="complete"){i.detachEvent(A,z);for(var a=i.getElementsByTagName(u),b=0,c=a.length;b<c;++b)v.initElement(a[b])}}function B(){var a=event.srcElement,b=a.parentNode;a.blur();
+b.focus()}function C(){var a=event.propertyName;if(a==="width"||a==="height"){var b=event.srcElement,c=b.getContext("2d"),d=parseInt(b[a]);if(isNaN(d)||d<0)d=a==="width"?300:150;else if(d===0)d=1;b.style[a]=d+"px";c.I(b.clientWidth,b.clientHeight)}}function D(){h.detachEvent(E,D);for(var a in o){var b=o[a],c=b.firstChild,d;for(d in c)if(typeof c[d]==="function")c[d]=k;for(d in b)if(typeof b[d]==="function")b[d]=k;c.detachEvent(F,B);b.detachEvent(G,C)}h[H]=k;h[I]=k;h[J]=k;h[K]=k;h[L]=k}function M(a){return(""+
+a).replace(/&/g,"&amp;").replace(/</g,"&lt;")}var k=null,u="canvas",H="CanvasRenderingContext2D",I="CanvasGradient",J="CanvasPattern",K="FlashCanvas",L="G_vmlCanvasManager",F="onfocus",G="onpropertychange",A="onreadystatechange",E="onunload",r=function(){var a=i.getElementsByTagName("script");a=a[a.length-1];return i.documentMode>=8?a.src:a.getAttribute("src",4)}().replace(/[^\/]+$/,"flashcanvas.swf"),e=new function(a){for(var b=0,c=a.length;b<c;b++)this[a[b]]=b}(["toDataURL","save","restore","scale",
+"rotate","translate","transform","setTransform","globalAlpha","globalCompositeOperation","strokeStyle","fillStyle","createLinearGradient","createRadialGradient","createPattern","lineWidth","lineCap","lineJoin","miterLimit","shadowOffsetX","shadowOffsetY","shadowBlur","shadowColor","clearRect","fillRect","strokeRect","beginPath","closePath","moveTo","lineTo","quadraticCurveTo","bezierCurveTo","arcTo","rect","arc","fill","stroke","clip","isPointInPath","font","textAlign","textBaseline","fillText","strokeText",
+"measureText","drawImage","createImageData","getImageData","putImageData","addColorStop","direction","resize"]),s={},l={},o={},t={};q.prototype={save:function(){this.b();this.c();this.m();this.l();this.z();this.w();this.F.push([this.f,this.g,this.A,this.u,this.j,this.h,this.i,this.k,this.p,this.q,this.n,this.o,this.v,this.r,this.s]);this.a.push(e.save)},restore:function(){var a=this.F;if(a.length){a=a.pop();this.globalAlpha=a[0];this.globalCompositeOperation=a[1];this.strokeStyle=a[2];this.fillStyle=
+a[3];this.lineWidth=a[4];this.lineCap=a[5];this.lineJoin=a[6];this.miterLimit=a[7];this.shadowOffsetX=a[8];this.shadowOffsetY=a[9];this.shadowBlur=a[10];this.shadowColor=a[11];this.font=a[12];this.textAlign=a[13];this.textBaseline=a[14]}this.a.push(e.restore)},scale:function(a,b){this.a.push(e.scale,a,b)},rotate:function(a){this.a.push(e.rotate,a)},translate:function(a,b){this.a.push(e.translate,a,b)},transform:function(a,b,c,d,f,g){this.a.push(e.transform,a,b,c,d,f,g)},setTransform:function(a,b,
+c,d,f,g){this.a.push(e.setTransform,a,b,c,d,f,g)},b:function(){var a=this.a;if(this.f!==this.globalAlpha){this.f=this.globalAlpha;a.push(e.globalAlpha,this.f)}if(this.g!==this.globalCompositeOperation){this.g=this.globalCompositeOperation;a.push(e.globalCompositeOperation,this.g)}},m:function(){if(this.A!==this.strokeStyle){var a=this.A=this.strokeStyle;this.a.push(e.strokeStyle,typeof a==="object"?a.id:a)}},l:function(){if(this.u!==this.fillStyle){var a=this.u=this.fillStyle;this.a.push(e.fillStyle,
+typeof a==="object"?a.id:a)}},createLinearGradient:function(a,b,c,d){this.a.push(e.createLinearGradient,a,b,c,d);return new p(this)},createRadialGradient:function(a,b,c,d,f,g){this.a.push(e.createRadialGradient,a,b,c,d,f,g);return new p(this)},createPattern:function(a,b){if(a.tagName.toUpperCase()==="IMG"){var c=a.getAttribute("src",2),d=this.d;this.a.push(e.createPattern,c,b);if(s[d]){this.e();++l[d]}return new y(this)}},z:function(){var a=this.a;if(this.j!==this.lineWidth){this.j=this.lineWidth;
+a.push(e.lineWidth,this.j)}if(this.h!==this.lineCap){this.h=this.lineCap;a.push(e.lineCap,this.h)}if(this.i!==this.lineJoin){this.i=this.lineJoin;a.push(e.lineJoin,this.i)}if(this.k!==this.miterLimit){this.k=this.miterLimit;a.push(e.miterLimit,this.k)}},c:function(){var a=this.a;if(this.p!==this.shadowOffsetX){this.p=this.shadowOffsetX;a.push(e.shadowOffsetX,this.p)}if(this.q!==this.shadowOffsetY){this.q=this.shadowOffsetY;a.push(e.shadowOffsetY,this.q)}if(this.n!==this.shadowBlur){this.n=this.shadowBlur;
+a.push(e.shadowBlur,this.n)}if(this.o!==this.shadowColor){this.o=this.shadowColor;a.push(e.shadowColor,this.o)}},clearRect:function(a,b,c,d){this.a.push(e.clearRect,a,b,c,d)},fillRect:function(a,b,c,d){this.b();this.c();this.l();this.a.push(e.fillRect,a,b,c,d)},strokeRect:function(a,b,c,d){this.b();this.c();this.m();this.z();this.a.push(e.strokeRect,a,b,c,d)},beginPath:function(){this.a.push(e.beginPath)},closePath:function(){this.a.push(e.closePath)},moveTo:function(a,b){this.a.push(e.moveTo,a,b)},
+lineTo:function(a,b){this.a.push(e.lineTo,a,b)},quadraticCurveTo:function(a,b,c,d){this.a.push(e.quadraticCurveTo,a,b,c,d)},bezierCurveTo:function(a,b,c,d,f,g){this.a.push(e.bezierCurveTo,a,b,c,d,f,g)},arcTo:function(a,b,c,d,f){this.a.push(e.arcTo,a,b,c,d,f)},rect:function(a,b,c,d){this.a.push(e.rect,a,b,c,d)},arc:function(a,b,c,d,f,g){this.a.push(e.arc,a,b,c,d,f,g?1:0)},fill:function(){this.b();this.c();this.l();this.a.push(e.fill)},stroke:function(){this.b();this.c();this.m();this.z();this.a.push(e.stroke)},
+clip:function(){this.a.push(e.clip)},w:function(){var a=this.a;if(this.v!==this.font)try{var b=t[this.d];b.style.font=this.v=this.font;var c=b.currentStyle;a.push(e.font,[c.fontStyle,c.fontWeight,b.offsetHeight,c.fontFamily].join(" "))}catch(d){}if(this.r!==this.textAlign){this.r=this.textAlign;a.push(e.textAlign,this.r)}if(this.s!==this.textBaseline){this.s=this.textBaseline;a.push(e.textBaseline,this.s)}if(this.t!==this.canvas.currentStyle.direction){this.t=this.canvas.currentStyle.direction;a.push(e.direction,
+this.t)}},fillText:function(a,b,c,d){this.b();this.l();this.c();this.w();this.a.push(e.fillText,M(a),b,c,d===void 0?Infinity:d)},strokeText:function(a,b,c,d){this.b();this.m();this.c();this.w();this.a.push(e.strokeText,M(a),b,c,d===void 0?Infinity:d)},measureText:function(a){var b=t[this.d];try{b.style.font=this.font}catch(c){}b.innerText=a.replace(/[ \n\f\r]/g,"\t");return new P(b.offsetWidth)},drawImage:function(a,b,c,d,f,g,m,j,w){if(a.tagName.toUpperCase()==="IMG"){var n=arguments.length,x=a.getAttribute("src",
+2),N=this.d;this.b();this.c();if(n===3)this.a.push(e.drawImage,n,x,b,c);else if(n===5)this.a.push(e.drawImage,n,x,b,c,d,f);else if(n===9)this.a.push(e.drawImage,n,x,b,c,d,f,g,m,j,w);else return;if(s[N]){this.e();++l[N]}}},D:function(){this.globalAlpha=this.f=1;this.globalCompositeOperation=this.g="source-over";this.fillStyle=this.u=this.strokeStyle=this.A="#000000";this.lineWidth=this.j=1;this.lineCap=this.h="butt";this.lineJoin=this.i="miter";this.miterLimit=this.k=10;this.shadowBlur=this.n=this.shadowOffsetY=
+this.q=this.shadowOffsetX=this.p=0;this.shadowColor=this.o="rgba(0,0,0,0)";this.font=this.v="10px sans-serif";this.textAlign=this.r="start";this.textBaseline=this.s="alphabetic";this.a=[];this.F=[]},H:function(){var a=this.a;this.a=[];return a},e:function(){var a=this.H();if(a.length>0)return eval(this.B.CallFunction('<invoke name="executeCommand" returntype="javascript"><arguments><string>'+a.join("&#0;")+"</string></arguments></invoke>"))},I:function(a,b){this.e();this.D();this.B.width=a;this.B.height=
+b;this.a.push(e.resize,a,b)}};p.prototype={addColorStop:function(a,b){this.G.a.push(e.addColorStop,this.id,a,b)}};var v={initElement:function(a){if(a.getContext)return a;var b=a.uniqueID,c="external"+b;s[b]=false;l[b]=1;a.innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+location.protocol+'//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="'+c+'"><param name="allowScriptAccess" value="always"><param name="flashvars" value="id='+
+c+'"><param name="wmode" value="transparent"></object><span style="margin:0;padding:0;border:0;display:inline-block;position:static;height:1em;overflow:visible;white-space:nowrap"></span>';o[b]=a;var d=a.firstChild;t[b]=a.lastChild;var f=i.body.contains;if(f(a))d.movie=r;else var g=setInterval(function(){if(f(a)){clearInterval(g);d.movie=r}},0);if(i.compatMode==="BackCompat"||!h.XMLHttpRequest)t[b].style.overflow="hidden";var m=new q(a,d);a.getContext=function(j){return j==="2d"?m:k};a.toDataURL=
+function(j,w){j=j?j.toLowerCase():"image/png";j==="image/jpeg"?m.a.push(e.toDataURL,j,w||0.5):m.a.push(e.toDataURL,j);return m.e()};d.attachEvent(F,B);return a},saveImage:function(a){a.firstChild.saveImage()},setOptions:function(){},trigger:function(a,b){o[a].fireEvent("on"+b)},unlock:function(a,b){l[a]&&--l[a];if(b){var c=o[a],d=c.firstChild,f=parseInt(c.width),g=parseInt(c.height);if(isNaN(f)||f<0)f=300;if(isNaN(g)||g<0)g=150;c.style.width=f+"px";c.style.height=g+"px";d.width=c.width=f;d.height=
+c.height=g;d.resize(f,g);c.attachEvent(G,C);s[a]=true}}};i.createElement(u);i.createStyleSheet().cssText=u+"{display:inline-block;overflow:hidden;width:300px;height:150px}";i.attachEvent(A,z);h.attachEvent(E,D);if(r.indexOf(location.protocol+"//"+location.host+"/")===0){var O=new ActiveXObject("Microsoft.XMLHTTP");O.open("GET",r,false);O.send(k)}h[H]=q;h[I]=p;h[J]=y;h[K]=v;h[L]={init:function(){},init_:function(){},initElement:v.initElement};keep=q.measureText}(window,document);

Propchange: incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.swf
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.swf?rev=1040591&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wookie/trunk/widgets/butterfly/scripts/flashcanvas.swf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream