Permalink
Browse files

Merge Processing.js v1.4.0 into master

  • Loading branch information...
2 parents 095ed41 + 0fd7b85 commit 02363398a823eae731cafa180a5581fe353397bf @jbuck jbuck committed Jul 30, 2012
Showing with 2,638 additions and 814 deletions.
  1. +2 −1 AUTHORS
  2. +45 −0 CHANGELOG
  3. +6 −0 LICENSE
  4. +1 −2 README.md
  5. +51 −0 examples/seneca/Processing.reload/index.html
  6. +1 −0 examples/seneca/Processing.reload/sketch1.pde
  7. +1 −0 examples/seneca/Processing.reload/sketch2.pde
  8. +1 −0 examples/seneca/Processing.reload/sketch3.pde
  9. +1 −0 examples/seneca/Processing.reload/sketch4.pde
  10. +1 −0 examples/seneca/Processing.reload/sketch5.pde
  11. +1 −0 examples/seneca/Processing.reload/sketch6.pde
  12. +7 −0 examples/seneca/canvas properties/demo.pde
  13. +22 −0 examples/seneca/canvas properties/index.html
  14. +4 −0 examples/seneca/file and fragment loading (1818)/fafl.pde
  15. +25 −0 examples/seneca/file and fragment loading (1818)/index.html
  16. +25 −0 examples/seneca/fontcache (1741)/fontcache.pde
  17. +37 −0 examples/seneca/fontcache (1741)/index.html
  18. +86 −0 examples/seneca/inspection (1867)/index.html
  19. +0 −60 examples/seneca/pimage/pimageget.htm
  20. +0 −56 examples/seneca/pimage/pimageget.pjs
  21. +19 −0 examples/seneca/xml (1806)/index.html
  22. +5 −0 examples/seneca/xml (1806)/test.xml
  23. +157 −0 extensions/processing-inspector.js
  24. +8 −6 extensions/processing-lazyload.js
  25. +1,101 −602 processing.js
  26. +0 −2 test/KNOWN-FAILURES
  27. +6 −0 test/parser/ticket1688.pde
  28. +1 −1 test/perf/tests.js
  29. +1 −0 test/ref/additive-wave.pde
  30. +16 −3 test/ref/arc-fill-crisp.pde
  31. +1 −0 test/ref/array-objects.pde
  32. +1 −0 test/ref/bounce.pde
  33. +1 −0 test/ref/bouncy-bubbles.pde
  34. +1 −0 test/ref/brownian.pde
  35. +1 −0 test/ref/circle-collision.pde
  36. +1 −1 test/ref/color-wheel.pde
  37. +1 −0 test/ref/composite-objects.pde
  38. +1 −0 test/ref/conway.pde
  39. +10 −0 test/ref/curRectMode.pde
  40. +2 −2 test/ref/curveDetail.pde
  41. +1 −1 test/ref/empty-draw-3D.pde
  42. +2 −0 test/ref/flocking.pde
  43. +1 −5 test/ref/icosahedron.pde
  44. +1 −0 test/ref/increment-or-decrement.pde
  45. +48 −31 test/ref/index.html
  46. +1 −0 test/ref/inheritence.pde
  47. +1 −0 test/ref/integers-and-floats.pde
  48. +1 −0 test/ref/linear-image.pde
  49. +1 −0 test/ref/linear.pde
  50. +1 −0 test/ref/milliseconds.pde
  51. +1 −0 test/ref/moving-on-curves.pde
  52. +1 −0 test/ref/multiple-particle-systems.pde
  53. +1 −0 test/ref/noise-wave.pde
  54. +1 −0 test/ref/noise1d.pde
  55. +1 −0 test/ref/noise3d.pde
  56. +24 −0 test/ref/pgraphics.pde
  57. +56 −0 test/ref/pimage-get-and-place.pde
  58. +7 −0 test/ref/pimage-resize-bigger.pde
  59. +7 −0 test/ref/pimage-resize-smaller.pde
  60. +7 −0 test/ref/pimage-resize-x.pde
  61. +7 −0 test/ref/pimage-resize-y.pde
  62. +2 −4 test/ref/pixelarray.pde
  63. +8 −0 test/ref/point_3D_smooth.pde
  64. +10 −0 test/ref/point_3D_smooth_beginShape.pde
  65. +8 −0 test/ref/point_3D_smooth_hint_off.pde
  66. +29 −0 test/ref/point_3D_smooth_stroke.pde
  67. +1 −0 test/ref/pointillism.pde
  68. +1 −0 test/ref/polar-to-cartesian.pde
  69. +12 −0 test/ref/pshape_ellipseMode.pde
  70. +12 −0 test/ref/pshape_svg.pde
  71. +1 −0 test/ref/puff.pde
  72. +1 −0 test/ref/reflection.pde
  73. +1 −0 test/ref/reflection1.pde
  74. +1 −0 test/ref/reflection2.pde
  75. +1 −0 test/ref/rotate.pde
  76. +1 −5 test/ref/rotatepushpop.pde
  77. +1 −5 test/ref/rotatexy.pde
  78. +1 −0 test/ref/scale.pde
  79. +1 −0 test/ref/sequential.pde
  80. +10 −0 test/ref/shearx-3D.pde
  81. +11 −0 test/ref/shearx.pde
  82. +10 −0 test/ref/sheary-3D.pde
  83. +11 −0 test/ref/sheary.pde
  84. +1 −0 test/ref/simple-particle-system.pde
  85. +1 −0 test/ref/sine-and-cosine.pde
  86. +1 −0 test/ref/sine.pde
  87. +11 −9 test/ref/smoke-particle-system.pde
  88. +1 −0 test/ref/spore1.pde
  89. +22 −0 test/ref/svg-buffered.pde
  90. +30 −9 test/ref/tests.js
  91. +2 −2 test/ref/tint-isImageDirty.pde
  92. +1 −0 test/ref/translate.pde
  93. +15 −0 test/unit/XMLElement/P52.0/XMLAddChild.pde
  94. +17 −0 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeGet.pde
  95. +10 −0 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeRemove.pde
  96. +19 −0 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeSet.pde
  97. +24 −0 test/unit/XMLElement/P52.0/XMLEquals.pde
  98. +20 −0 test/unit/XMLElement/P52.0/XMLGetChild.pde
  99. +21 −0 test/unit/XMLElement/P52.0/XMLGetChildNS.pde
  100. +22 −0 test/unit/XMLElement/P52.0/XMLInsertChild.pde
  101. +29 −0 test/unit/XMLElement/P52.0/XMLRemoveChild.pde
  102. +17 −0 test/unit/XMLElement/P52.0/XMLRemoveChildAtIndex.pde
  103. +21 −0 test/unit/XMLElement/P52.0/XMLgetChildCount.pde
  104. +10 −0 test/unit/XMLElement/P52.0/XMLgetContent.pde
  105. +1 −1 test/unit/XMLElement/XMLAttribute/XMLAttributeGet.pde
  106. +1 −1 test/unit/XMLElement/XMLAttribute/XMLAttributeRemove.pde
  107. +21 −0 test/unit/XMLElement/XMLElementGetChildNS.pde
  108. +8 −0 test/unit/XMLElement/XMLElementWithCDATA.pde
  109. +2 −2 test/unit/arrayCopy.pde
  110. +3 −0 test/unit/arrayList.pde
  111. +27 −0 test/unit/arrayListIndexing.pde
  112. +19 −0 test/unit/arrayListRemoveAll.pde
  113. +15 −0 test/unit/dollarSignCtor.pde
  114. +27 −0 test/unit/generics.pde
  115. +17 −0 test/unit/hashMapIteratorRemove.pde
  116. +2 −0 test/unit/hashmap-iterator.pde
  117. +37 −0 test/unit/methodargs.pde
  118. +25 −0 test/unit/pmatrix2d.pde
  119. +132 −0 test/unit/pmatrix3d.pde
  120. +25 −0 test/unit/splitTokens.pde
  121. +22 −0 test/unit/ticket1810.pde
  122. +3 −3 tools/fake-dom.js
View
@@ -13,7 +13,7 @@ Mickael Medel
Matthew Lam
Jon Buckley
Dominic Baranski
-Elijah Grey
+Eli Grey
Thomas Saunders
Abel Allison
Andrew Grimo
@@ -33,3 +33,4 @@ Jonathan Brodsky
Roger Sodre
James Boelen
Michal Ejdys
+Greg Krilov
View
@@ -1,3 +1,48 @@
+July 31, 2012 - Release 1.4.0
+
+ * Added a PJS object inspector [#1867]
+ * Added ArrayList.lastIndexOf() [#1837]
+ * Added ArrayList.removeAll() [#1001]
+ * Added CDATA support to XML [#1788]
+ * Added check for IE9 non-HTML5 doctype [#1606]
+ * Added online global variable [#1743]
+ * Added option to stop ref test suite on failures [#1681]
+ * Added PFont cache limits [#1741]
+ * Added PImage.get() ref tests [#1601]
+ * Added point smoothing in 3D [#602]
+ * Added Processing.reload() [#1133]
+ * Added shearX() and shearX() to 2D mode [#1640]
+ * Added shearX() and shearY() in 3D mode [#1773]
+ * Added support for Processing 2.0 XML support [#1806]
+ * Added support for variable arguments [#1842]
+ * Added tinyLogLite license and author to LICENSE [#1731]
+ * Enabled preserveDrawingBuffer when context is acquired [#1651]
+ * Fixed array initialization code [#1817]
+ * Fixed ArrayList(int) constructor [#1829]
+ * Fixed data-processing-sources to seperate files or ids by whitespace, not just spaces [#1818]
+ * Fixed handling of namespaces in XMLElement.getChild [#1382]
+ * Fixed HashMap iterator.remove() bug [#1871]
+ * Fixed I-bar cursor appearing on click-dragging [#1755]
+ * Fixed IE9 hanging on exception without debugger [#1789]
+ * Fixed init to cache <script> elements [#1740]
+ * Fixed lazy loading height calculation [#1846]
+ * Fixed naming convention in shaders [#1279]
+ * Fixed off-by-one error in arc startLUT calculations [#1802]
+ * Fixed overloaded method calls [#1810]
+ * Fixed parser to allow $ in names [#1688]
+ * Fixed PGraphics initially not transparent [#1813]
+ * Fixed PImage.toImageData using cached image data [#1768]
+ * Fixed popStyle() setting rectMode() to undefined [#1771]
+ * Fixed PShape to work with PGraphics [#1778]
+ * Fixed PShape.shape() changing rectMode() and ellipseMode() [#1753]
+ * Fixed right-click context menu appearing in 3D sketches [#1779]
+ * Fixed splitTokens() to work with special characters [#1799]
+ * Fixed textSize() not resetting font metrics [#1687]
+ * Removed duplicate curElement assigned code [#1763]
+ * Set animated ref tests to run at 1000 FPS [#1830]
+ * Unmarked ref tests as known fails due to FF9 JIT bugs [#1700]
+ * Updated the generics regexp for array notation [#1812]
+
October 13, 2011 - Release 1.3.6
* Fixed arc() not filling the last half degree [#1717]
View
@@ -1,3 +1,4 @@
+Processing.js
Copyright (C) 2008 John Resig
Copyright (C) 2009-2011; see the AUTHORS file for authors and
copyright holders.
@@ -20,3 +21,8 @@ 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.
+
+
+tinylog lite JavaScript library
+Copyright (C) 2010 Eli Grey
+https://github.com/eligrey/tinylog
View
@@ -1,4 +1,3 @@
-
Processing.js - @VERSION@
=========================
a port of the Processing visualization language
@@ -134,7 +133,7 @@ Processing Developers at http://processingjs.org/reference/articles/p5QuickStart
JavaScript developers should start with the Processing.js Quick Start Guide for
JavaScript Developers at http://processingjs.org/reference/articles/jsQuickStart
-A more detailed guide is http://processingjs.org/reference/articles/PomaxGuide.
+A more detailed guide is http://processingjs.org/articles/PomaxGuide.html
A complete reference of all Processing.js functions and variables is available
at http://processingjs.org/reference.
@@ -0,0 +1,51 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Processing.reload() demonstrator</title>
+ <meta charset="utf-8">
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/javascript">
+ function swap_content() {
+ var html4 = '<p>sketch 4</p>'+"\n"+'<canvas id="sketch4" data-processing-sources="sketch4.pde"></canvas>' + "\n";
+ var html5 = '<p>sketch 5</p>'+"\n"+'<canvas id="sketch5" data-processing-sources="sketch5.pde"></canvas>' + "\n";
+ var html6 = '<p>sketch 6</p>'+"\n"+'<canvas id="sketch6" data-processing-sources="sketch6.pde"></canvas>' + "\n";
+ var html = html4 + html5 + html6;
+ document.getElementById('content').innerHTML = html;
+ Processing.reload();
+ }
+ </script>
+ </head>
+ <body>
+ <h1>Processing.reload()</h1>
+
+ <p>This example shows the use of Processing.reload(),
+ used to tell Processing to rescan the DOM for sketches
+ that should be loaded after DOM manipulations such as
+ swapping content in/out. Sketches are unloaded after
+ calling sketch.exit() on them, and their sketch bindings
+ are removed from Processing's instances list.</p>
+
+ <pre> &lt;script type="text/javascript"&gt;
+ function swap_content() {
+ var html = "&lt;... ... ...&gt;";
+ document.getElementById('content').innerHTML = html;
+ Processing.reload();
+ }
+ &lt;/script&gt;
+ &lt;input type="button" onclick="swap_content()"&gt;</pre>
+
+ <div id="content">
+ <p>sketch 1</p>
+ <canvas id="sketch1" data-processing-sources="sketch1.pde"></canvas>
+
+ <p>sketch 2</p>
+ <canvas id="sketch2" data-processing-sources="sketch2.pde"></canvas>
+
+ <p>sketch 3</p>
+ <canvas id="sketch3" data-processing-sources="sketch3.pde"></canvas>
+ </div>
+
+ <p>Press the button to swap the content for three different sketches</p>
+ <input type="button" value="swap" onclick="swap_content()">
+ </body>
+</html>
@@ -0,0 +1 @@
+text("1",50,50);
@@ -0,0 +1 @@
+text("2",50,50);
@@ -0,0 +1 @@
+text("3",50,50);
@@ -0,0 +1 @@
+text("4",50,50);
@@ -0,0 +1 @@
+text("5",50,50);
@@ -0,0 +1 @@
+text("6",50,50);
@@ -0,0 +1,7 @@
+cursor(CROSS);
+void setup() { size(100,100); noLoop(); }
+void draw() { background(0,0,200); }
+void mousePressed() { println("mouse pressed"); }
+void mouseDragged() { println("mouse dragged"); }
+void mouseReleased() { println("mouse released"); }
+void mouseClicked() { println("mouse clicked"); }
@@ -0,0 +1,22 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Canvas properties explanation</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ </head>
+ <body>
+
+ <h1>Canvas properties</h1>
+
+ <p>By default any element that is tab-focussable (via tabindex)
+ gets an outline rendered by certain browsers. We turn this outline
+ off for canvas, by setting the canvas's style property "outline: none".
+ We also disable the onmousedown handler and text-select properties so
+ that the canvas does not count as a text-selectable item. Click-dragging
+ the canvas will not show the typical I-bar cursor associated with
+ text selection, and double clicking the canvas will not select it
+ as if it was a text element.</p>
+
+ <canvas data-processing-sources="demo.pde"></canvas>
+ </body>
+</html>
@@ -0,0 +1,4 @@
+void setup() {
+ size(400,400);
+ noLoop();
+}
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+<head>
+ <title>File and fragment loading test (ticket 1818)</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/processing" id="customcode">
+ void draw() {
+ background(255,255,100);
+ fill(0);
+ textAlign(CENTER);
+ text("custom code inclusion worked", width/2, height/2);
+ }
+ </script>
+</head>
+<body>
+
+ <h1>Mixed from-file and from-fragment loading of sketches</h1>
+
+ <p>This should show a yellowish sketch, with the text "custom code inclusion worked", centered.</p>
+
+ <canvas id="t1818test" data-processing-sources="fafl.pde
+ #customcode
+ "></canvas>
+</body>
+</html>
@@ -0,0 +1,25 @@
+void setup()
+{
+ size(200,200);
+ text("",0,0);
+}
+
+void draw()
+{
+ float ts = random(10,60);
+ textSize(ts);
+ fill(255,255,0,50);
+ rect(-1,-1,width+2,height+2);
+ fill(0);
+ float tw = textWidth("testing");
+ text("testing",(width-tw)/2,(height+ts/2)/2);
+
+ var cl = Processing.prototype.PFont.PFontCache.length;
+
+ var caching = Processing.prototype.PFont.prototype.caching || false;
+ if(!caching && cl) caching = "metrics only";
+ document.getElementById("cache").innerHTML = caching;
+
+ if(!cl) cl = "n/a";
+ document.getElementById("log").innerHTML = cl;
+}
@@ -0,0 +1,37 @@
+<html>
+ <head>
+ <title>fontcache</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/javascript">
+ var sketch = null;
+ (function getSketch() {
+ sketch = Processing.getInstanceById('sketch');
+ if(!sketch) { setTimeout(getSketch, 500); }
+ else {
+ // ...
+ }}());
+ </script>
+ </head>
+ <body>
+
+ <h1>Font cache testing</h1>
+
+ <canvas id="sketch" data-processing-sources="fontcache.pde"></canvas>
+
+ <p>This test makes sure that even though a large number of
+ distinct font objects will be used, Processing.js switches
+ over from full font object caching to initial-metrics-only
+ caching when 50 fonts have been cached, turning off caching
+ entirely once the metrics-only font cache hits 400 fonts.</p>
+
+ <p>The test is performed by having a sketch use a textSize(random(10,60)),
+ which allows for 501 distinct font name/size pairs to be cached, due to
+ font sizes being rounded to a single decimal value. As such even though
+ one font is used, its possible size values 10.0, 10.1, ... , 59.9, 60.0
+ leads to 501 possible pairs.</p>
+
+ <div>caching: <span id="cache"></span></div>
+
+ <div>cache size: <span id="log"></span></div>
+ </body>
+</html>
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Processing inspector extension test</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/javascript" src="../../../extensions/processing-inspector.js"></script>
+</head>
+<body>
+ <h1>Processing Inspector</h1>
+
+ <h3>number spinners should be continuously updated. spin them to see the line change.
+ click sketch to pause, allowing spinner updates. click sketch again to release monitored
+ values (changing them still affects sketch, but sketch no longer affects them).</h3>
+
+ <script type="text/processing">
+ class A {
+ float x=0, y=0;
+ void setX(float v) { x = v; }
+ void setY(float v) { y = v; }
+ }
+
+ class B extends A {}
+
+ class C extends B {
+ String printThis() { return x + "/" + y; }
+ }
+
+ C test;
+ C getTest() { return test; }
+
+ void setup() {
+ size(100,100);
+ test = new C();
+ test.setX(40);
+ test.setY(0);
+ stroke(0);
+ }
+
+ float step = PI/20;
+ void draw() {
+ background(240);
+ float x = test.x,
+ y = test.y;
+ float nx = x * cos(step) - y * sin(step),
+ ny = x * sin(step) + y * cos(step);
+ test.setX(nx);
+ test.setY(ny);
+ line(width/2, height/2, width/2 + test.x, height/2 + test.y);
+ }
+
+ boolean unbind = false;
+ void mousePressed() {
+ if(!unbind) {
+ unbind = true;
+ noLoop();
+ }
+ else {
+ loop();
+ ProcessingInspector.release(test, "x");
+ ProcessingInspector.release(test, "y");
+ }
+ }
+
+ // processing.js event handling
+ onload = function() {
+ var xControl = document.getElementById('x_control');
+ xControl.onchange = function() { test.x = this.value; redraw(); }
+ var callback = function(obj, attr, val) { xControl.value = val|0; };
+ ProcessingInspector.monitor(test, "x", callback);
+
+ var yControl = document.getElementById('y_control');
+ yControl.onchange = function() { test.y = this.value; redraw(); }
+ callback = function(obj, attr, val) { yControl.value = val|0; };
+ ProcessingInspector.monitor(test, "y", callback);
+ }
+ </script>
+ <canvas></canvas>
+
+ <div>
+ <input id="x_control" type="number" min="-100" max="100" step="1">
+ <input id="y_control" type="number" min="-100" max="100" step="1">
+ </div>
+
+</body>
+</html>
Oops, something went wrong.

0 comments on commit 0236339

Please sign in to comment.