Commit graph

236 commits

Author SHA1 Message Date
Jonathan Puckey
507ff8bb23 Add ProxyContext helper class to assist in debugging problems relating to interactions with the canvas' 2d context. 2012-03-01 22:25:35 +01:00
Jonathan Puckey
ddec658653 Make Paper.js work on Node.js. 2011-07-30 02:16:30 +02:00
Jürg Lehni
3a7c5286b5 Improve precision of Line#intersect() and other parts that check for a divisor to not be 0, by comparing against the new Numerical.EPSILON rather than Numerical.TOLERANCE. 2011-07-28 11:03:59 +01:00
Jürg Lehni
ba4ff62052 Clean up white space. 2011-07-26 16:00:49 +01:00
Jürg Lehni
8eaeb7fb5e Remove filepp.pl as preprocessor and switch to our own Prepro.js, a simple preprocesssor for JavaScript that speaks JavaScript, written in JavaScript, allowing preprocessing to either happen at build time or compile time. 2011-07-26 10:09:31 +01:00
Jürg Lehni
833d4968ce Change root solvers to not produce new arrays each time but fill a passed one that can be reused. Yields io impressive performance improvements. 2011-07-09 10:50:47 +02:00
Jürg Lehni
5655981f6d Clean up white spaces. 2011-07-07 16:09:02 +02:00
Jürg Lehni
10e7cc994c Fix porting mistakes. 2011-07-06 15:31:36 +02:00
Jürg Lehni
99f6597615 Fix check for quadratic curve by using the right coefficient (a instead of d), and checking with tolerance. 2011-07-05 17:03:49 +02:00
Jürg Lehni
2a9066c555 Fix comment. 2011-07-05 01:17:37 +02:00
Jürg Lehni
f6f4c917f4 Fix accidentally removed comas. 2011-07-05 01:16:20 +02:00
Jürg Lehni
24d77c1ece Remove root fixing code again, seems not necessary. 2011-07-05 01:14:20 +02:00
Jürg Lehni
8a2a9409bd Commit experimental root fixing code. 2011-07-05 01:13:58 +02:00
Jürg Lehni
dad118cc20 Fix comments. 2011-07-04 23:30:25 +02:00
Jürg Lehni
9cf5292496 Define solvers for cubic and quadratic polynomials, as required by hit testing code. 2011-07-04 19:47:54 +02:00
Jürg Lehni
79c0ad8cc5 Update copyright notices. 2011-07-01 12:17:45 +02:00
Richard D. Worth
ac39873693 Whitespace. Removed all trailing whitespace from .js files 2011-06-30 06:01:51 -04:00
Jürg Lehni
7cd749e63d Change all documentation to new convention of defining @class outside injection scope, fix some comments and a few errors with examples. 2011-06-22 23:56:05 +01:00
Jürg Lehni
d5e7ca9f5e Improve explanatory comments. 2011-06-06 11:44:15 +01:00
Jürg Lehni
702269675a Start adding support for rhino-canvas on server. 2011-06-03 14:05:55 +01:00
Jürg Lehni
4a51ff4215 Remove unneeded blend mode. 2011-06-02 14:33:42 +01:00
Jürg Lehni
c07fee0e6b Shorten variable names. 2011-06-02 09:38:13 +01:00
Jürg Lehni
bb11b74fa3 Clean up comments: No need for reference to Context Blender, since code has completely changed. 2011-06-02 09:36:49 +01:00
Jürg Lehni
b02b4bf7a3 Implement HSL blend modes according to PDF specs. 2011-06-02 09:33:41 +01:00
Jürg Lehni
5e7998d803 Rename parameter. 2011-06-01 20:34:35 +01:00
Jürg Lehni
f7bdfc5019 Clean up comments. 2011-06-01 20:32:37 +01:00
Jürg Lehni
d5952ba043 Implement HSB blend modes. 2011-06-01 20:21:25 +01:00
Jürg Lehni
09e9298bf4 Fix blend modes to work correctly with alpha channels. 2011-06-01 19:25:43 +01:00
Jürg Lehni
0d1fcfbb81 Remove unused blend mode 'normal'. 2011-06-01 17:21:14 +01:00
Jürg Lehni
f58aa2a23b Add comment about overlay mode being the reverse of hard-light. 2011-06-01 17:11:06 +01:00
Jürg Lehni
3850e4a53b Optimise code for normal and multiply blend modes by precalculating values. 2011-06-01 17:10:40 +01:00
Jürg Lehni
8bbb3744fe Use min() / max() in darken / lighten for shorter code. 2011-06-01 17:09:32 +01:00
Jürg Lehni
b08abcdd69 Remove 'unsupported' blend mode. 2011-06-01 16:50:14 +01:00
Jürg Lehni
9142c974c3 Revert to longer version of blend mode code as it is faster. 2011-06-01 16:49:48 +01:00
Jürg Lehni
62f5204810 Shorten variable names. 2011-06-01 16:45:42 +01:00
Jürg Lehni
44605433d1 Further shorten and simplify BlendMode cide by having process() only process one pixel value at a time. 2011-06-01 16:34:57 +01:00
Jürg Lehni
9fa193d26f Move opacity precalculation out of variable definition. 2011-06-01 15:31:02 +01:00
Jürg Lehni
117a828b2b Don't set dst[i + 3] directly, set dA2 instead. 2011-06-01 14:01:46 +01:00
Jürg Lehni
acecb1a2c1 Clean up variable names. 2011-06-01 14:01:22 +01:00
Jürg Lehni
b9739aa26a Optimise blend mode loop by pre-calculating divisions. 2011-06-01 14:00:50 +01:00
Jürg Lehni
4a9f0d726f Pre-calculate opacity value. 2011-06-01 14:00:02 +01:00
Jürg Lehni
a1d996df05 Clean up formating. 2011-06-01 13:42:34 +01:00
Jürg Lehni
69e989f834 No need to set dst[i + 3] again after changing dA2, since we are now only setting it after calling process() from the main loop. 2011-06-01 13:42:22 +01:00
Jürg Lehni
c47d281308 Speed up blend-modes by using a lookup table for process functions rather than a switch() statement for each pixel. 2011-06-01 13:37:36 +01:00
Jürg Lehni
29967153c3 Clean up TODO comments... 2011-06-01 10:49:43 +01:00
Jürg Lehni
01fdeb270b Move PaperScript.js to core. 2011-05-14 17:22:49 +01:00
Jürg Lehni
0356fdb3b6 Add PaperScope switching to onFrame handler. 2011-05-14 16:00:30 +01:00
Jürg Lehni
518803f492 Add support for switching PaperScope contexts in PaperScript code exeuction and callback handling. This should add proper support for multiple PaperScript instances in one site. 2011-05-14 14:15:31 +03:00
Jonathan Puckey
bd932a9242 Implement onFrame event.delta & event.time. 2011-05-11 22:46:08 +02:00
Jonathan Puckey
ccf5dd70f6 PaperScript: call the onFrame handler straight away. 2011-05-08 18:44:33 +01:00
Jürg Lehni
7034f8241b Remove deprecated onOptions. 2011-05-08 14:09:55 +01:00
Jürg Lehni
926fffee4a Rename Event -> DomEvent and Element -> DomElement, to be more specific and not clash with other classes, e.g. a future base class for ToolEvent and KeyEvent. 2011-05-08 10:16:11 +01:00
Jürg Lehni
c053fb977a Export PaperScript object and its load function as paper.load. 2011-05-07 20:50:32 +01:00
Jürg Lehni
081a303de0 Make sure PaperScripts are not loaded more than once by setting the loaded attribute to true on them. 2011-05-07 20:50:12 +01:00
Jürg Lehni
450d277fb4 Avoid necessity of try-catch around code evaluation by declaring all local variables that we are looking for. 2011-05-07 15:38:14 +01:00
Jürg Lehni
819c1c098c Clean up BlendMode code, and add comments about things not working yet. 2011-05-06 13:41:36 +01:00
Jürg Lehni
8a4fe7eb42 Tiny code simplification. 2011-05-06 13:29:21 +01:00
Jürg Lehni
3eb17f2953 Refrain from hacker style. 2011-05-04 15:20:42 +01:00
Jürg Lehni
e0edddd5f6 Clean up code ('){' -> ') {')). 2011-05-03 08:57:09 +01:00
Jürg Lehni
81461764a5 Add conditional code to CanvasProvider, with a TODO for implementing functionality for the server. 2011-04-28 08:48:50 +01:00
Jürg Lehni
cf79080682 Move browser related code to browser folder and use conditionals to not include them when producing paper.js for server. 2011-04-28 08:48:28 +01:00
Jürg Lehni
84d321bd56 Clean up comments. 2011-04-26 15:56:06 +01:00
Jürg Lehni
bdfe35d93a Consistently name local context variables 'ctx', to save line size and acknowledge the fact that Canvas contexts have a funny API design. 2011-04-26 15:39:16 +01:00
Jürg Lehni
189182b77c Rename loop function to frame. 2011-04-26 15:16:05 +01:00
Jürg Lehni
ba0c6dafea Add paper.debug switch, set it to true by default when loading code through load.js and use it to ignore focus / blur events in Event.requestAnimationFrame() during development. 2011-04-26 12:48:46 +01:00
Jürg Lehni
6609dc2307 Implement new root finding algorithm, combining Newton-Raphson Method with Bisection, and update Curve#getParameter() to use it. 2011-04-26 12:23:09 +01:00
Jürg Lehni
7868bc1bdc Remove obsolete comma. 2011-04-26 11:30:29 +01:00
Jonathan Puckey
05a138bc7b Implement onKeyDown / onKeyUp & Key#isDown(key). 2011-04-25 14:52:45 +02:00
Jürg Lehni
28c9254695 Rename onFrameLoop to onFrame. 2011-04-22 16:31:46 +01:00
Jürg Lehni
00958afd09 Explain lookup tables in Numerical. 2011-04-21 12:37:35 +01:00
Jürg Lehni
14010eb8b2 Format abscissas array for better reading. 2011-03-21 12:46:00 +00:00
Jürg Lehni
417d015eab Improve curve time parametrization precision by iteratively adding up sub-range lengths, and optimise speed by determining integration precision based on range size. 2011-03-20 11:38:06 +00:00
Jürg Lehni
a794816097 Fix wrong number of iterations in False Position method. 2011-03-20 02:03:26 +00:00
Jürg Lehni
0620a19eb9 Use False Position method as fall back in Newton-Raphson method, for accurate results in rare sitatuations wher the fast Newton-Raphson method fails. 2011-03-20 02:01:17 +00:00
Jürg Lehni
500942e86d Improve Numerical.integrate() by adding higher precision and supported iterations of up to n = 16. 2011-03-20 01:59:53 +00:00
Jürg Lehni
ad71293983 Remove Van Wijngaarden–Dekker–Brent method again as it led to imprecise results, and experiment with the very fast Newton-Raphson method (keeping False Position as a possible fallback for now). 2011-03-20 00:04:33 +00:00
Jürg Lehni
4e65d2c1d3 Fix simple syntax error. 2011-03-15 12:30:44 +01:00
Jürg Lehni
db1e7e8880 Simple optimisations. 2011-03-14 22:38:40 +01:00
Jürg Lehni
3a8bdeb19b Move scroll bounds code to Element.getScrollBounds(). 2011-03-14 22:37:31 +01:00
Jürg Lehni
ca9e70ade0 Request next animation frame at beginning of callback. 2011-03-14 22:35:31 +01:00
Jürg Lehni
2fcca38a9c Add support for onFrameLoop() callback to PaperScript. 2011-03-14 22:34:09 +01:00
Jürg Lehni
8179d7bf7e Clean up Event.requestAnimationFrame. 2011-03-14 22:19:06 +01:00
Jürg Lehni
6d8379f885 Separate Events into Event and Element object, add a row of useful Element helper functions and define experimental Event.requestAnimationFrame(). 2011-03-14 22:14:20 +01:00
Jonathan Puckey
fed52bd521 Paperscript#run: keep tool on global the paper object. 2011-03-09 19:33:53 +01:00
Jürg Lehni
6a67052090 Update copyright / licensing comments. 2011-03-08 01:41:50 +00:00
Jürg Lehni
8f78513174 Change naming of exported PaperScript methods. 2011-03-08 00:17:19 +00:00
Jürg Lehni
b4356078a7 Export PaperScript.install, so it can be loaded after onload. 2011-03-07 18:35:48 +00:00
Jürg Lehni
ff2b740c68 Use local references to often called Math functions, allowing uglify to shorten them further. 2011-03-07 16:49:02 +00:00
Jürg Lehni
59cb7e937e Add control over maximum iterations to Numerical.findRoot(). 2011-03-07 11:59:43 +00:00
Jürg Lehni
2ac9a13e2a Give Numerical methods more meaningful names. 2011-03-07 11:12:00 +00:00
Jürg Lehni
f5c79bf709 Clean up PaperScript code a bit. 2011-03-07 11:10:45 +00:00
Jürg Lehni
26caf099ca No need for all the .0 in brent() code. 2011-03-07 02:43:07 +00:00
Jürg Lehni
e1a7aff2f0 Add copyright notice and license file. 2011-03-07 00:50:44 +00:00
Jürg Lehni
91160bc5d7 Add copyright notices. 2011-03-07 00:40:48 +00:00
Jürg Lehni
003cfbd32b Format Gauss tables nicer. 2011-03-07 00:38:33 +00:00
Jürg Lehni
9fdbd0146d Rename MathUtils to Numerical. 2011-03-07 00:21:04 +00:00
Jürg Lehni
83fea3bf4e Clean up MathUtils code. 2011-03-07 00:17:32 +00:00
Jürg Lehni
b1e90efc9e Add Van Wijngaarden–Dekker–Brent method for root finding, ported from Numerical Recipes in C. 2011-03-06 23:25:57 +00:00
Jürg Lehni
29e57cc521 Replace slow simpson() method with insanely fast Gauss-Legendre Numerical Integration by Jim Armstrong which was further optimised. 2011-03-06 23:24:33 +00:00
Jonathan Puckey
40b7571489 Move BlendMode into util and add missing var. 2011-03-06 15:44:51 +01:00
Jürg Lehni
1607d744ef Implicitely call document.redraw() at the end of PaperScript execution. 2011-03-05 22:02:53 +00:00
Jürg Lehni
79d5a46cab Make it clear it's an empty loop. 2011-03-05 14:26:52 +00:00
Jürg Lehni
06e870f69c Improve some comments. 2011-03-05 14:26:16 +00:00
Jürg Lehni
342c5911c1 Add Events.getOffset(), to return coordinates relative to the target element's position. 2011-03-04 23:46:16 +00:00
Jürg Lehni
ef1da14c0e Use Events object to install 'load' event in PaperScript. 2011-03-04 23:32:11 +00:00
Jürg Lehni
b85235e1cb Add Events object as a helper for installing and removing events. 2011-03-04 23:31:51 +00:00
Jürg Lehni
92bf51a7cc Simplify the way the paper namespace is created and populated. 2011-03-04 13:34:31 +00:00
Jürg Lehni
6d00c723d9 Rename $operator() to more meaningful $eval(). 2011-03-04 11:15:04 +00:00
Jürg Lehni
11672d104f Align #include to the left. 2011-03-04 01:25:28 +00:00
Jürg Lehni
6f0f0cbd6b Fix comments. 2011-03-04 01:23:47 +00:00
Jürg Lehni
7462a58903 Change missleading variable name. 2011-03-04 01:22:08 +00:00
Jürg Lehni
5a640b50f8 No need to export handleOperator() and handleSignOperator(), just use local privates. 2011-03-04 01:20:29 +00:00
Jürg Lehni
17aee283ec Change sequence of handleOperator arguments for better readable resulting code. 2011-03-04 01:16:09 +00:00
Jürg Lehni
453da21bab Test code for tool handlers and only create tool if they are present. 2011-03-04 01:13:21 +00:00
Jürg Lehni
c86eaf5684 Use nice formatting in produced code. 2011-03-04 01:09:22 +00:00
Jürg Lehni
be0d260cb4 Add support for Tool scripts in PaperScript. 2011-03-04 01:05:23 +00:00
Jürg Lehni
b80ba6fc86 Add support for canvas attribute in paperscript tags. 2011-03-04 00:58:10 +00:00
Jürg Lehni
52ab361ed5 Include minified version of parse-js (25kb) inside PaperScript object. 2011-03-03 22:55:18 +00:00
Jürg Lehni
2b6dede883 Clean up white-spaces and line lengths. 2011-03-03 22:45:17 +00:00
Jürg Lehni
15a7b7e245 Add operator overloading through JS AST parsing and mangling to PaperScript. 2011-03-03 22:19:12 +00:00
Jürg Lehni
3324b083b7 Always execute PaperScripts on load, not on domready, as we want assets to be present as well. 2011-03-03 18:53:06 +00:00
Jürg Lehni
0b3c57ff88 Let paper be an instance of Base, and use its #extend() function to create scopes that inherit from paper but do not directly modify it. 2011-03-03 18:35:37 +00:00
Jürg Lehni
2c78a0a08b Add beginning of support for <script type="text/paperscript">, inspired by Coffee Script. 2011-03-03 18:31:56 +00:00
Jürg Lehni
dc75e14c59 Make sure utility objects stay in paper scope. 2011-03-03 16:32:39 +00:00
Jürg Lehni
07fcc000cf Move the new refactored CanvasDraw functionality to static Item.draw() and #draw() instance methods on each prototype. 2011-03-03 12:19:43 +00:00
Jonathan Puckey
136fe67917 Small change to CanvasDraw. 2011-03-03 02:25:09 +01:00
Jonathan Puckey
8ff04b6614 Unify canvas drawing commands in CanvasDraw.js and rework compositing code. 2011-03-03 02:22:21 +01:00
Jürg Lehni
5d680b1987 Reformat code and add comment about clearRect dimensions. 2011-03-02 16:07:44 +00:00
Jonathan Puckey
74f797a9dd Clean up whitespace. 2011-02-28 18:30:08 +01:00
Jürg Lehni
506e7c036c Merge remote-tracking branch 'origin/master' 2011-02-26 17:27:12 +01:00
Jürg Lehni
6d25dbbd22 Add beginning of path length calculations, work in progress. 2011-02-26 17:26:54 +01:00
Jonathan Puckey
9e6fd5a7e7 Speed up CanvasProvider. 2011-02-26 15:29:51 +01:00
Jonathan Puckey
83b8a3e815 Optimize CanvasProvider to only expect a Size object. 2011-02-24 01:36:38 +01:00
Jonathan Puckey
dc51384a1a Allow CanvasProvider to receive sizes too. 2011-02-24 01:29:51 +01:00
Jonathan Puckey
4c84379b5b Remove unused variable. 2011-02-21 03:26:46 +01:00
Jonathan Puckey
6fcdb86e1c Implement CanvasProvider that provides reusable canvas elements. 2011-02-21 03:17:09 +01:00