Commit graph

638 commits

Author SHA1 Message Date
Jürg Lehni
c4ad95b0ac More variable chaining... 2011-03-06 22:06:24 +00:00
Jürg Lehni
4c13ca6961 Fix syntax errors (that magically work on Safari). 2011-03-06 22:06:06 +00:00
Jürg Lehni
87981efeb5 Massive refactoring of transform() / getBounds() code: getBounds() / getStrokeBounds() now supports an optional Matrix parameter which is used to on the fly transform all coordinates and stroke definitions before bounds are calculated. This even supports the correct determination of rotated ellipse bounds for round strokes in symbols. 2011-03-06 21:26:38 +00:00
Jürg Lehni
6def2b9d3a Clean-up Path#arcTo() code. 2011-03-06 21:13:55 +00:00
Jürg Lehni
2d4cf2cc72 Replace beans access to Item#position with getter calls. 2011-03-06 21:12:11 +00:00
Jürg Lehni
8ddf5a3d90 Add Matrix#createShiftless(), to return a copy of the matrix that lacks the translation. 2011-03-06 21:10:47 +00:00
Jürg Lehni
670512d123 Finally figured out why Matrix#applyToContext was not working right: The parameters where not passed in the right sequence! 2011-03-06 21:09:52 +00:00
Jürg Lehni
994b9deb8f Fix Matrix#toString() to print values in correct sequence. 2011-03-06 21:08:37 +00:00
Jürg Lehni
607fe8f5d6 Improve argument handling in Matrix constructor. 2011-03-06 21:07:44 +00:00
Jürg Lehni
a7d08bcc08 Use variable definition chaining in Matrix where possible. 2011-03-06 21:06:46 +00:00
Jürg Lehni
32d0f31c31 Introduce Matrix.create() and use where applicable. 2011-03-06 21:05:24 +00:00
Jürg Lehni
47d55e19f5 Impove various angle related code in Point. 2011-03-06 21:03:43 +00:00
Jürg Lehni
420e0435ed Shorten create() methods, except for Point where it might have a performance impact. 2011-03-06 21:02:57 +00:00
Jürg Lehni
90b94a8d83 Various simplificiations and clean-ups in Path constructors. 2011-03-06 18:46:28 +00:00
Jürg Lehni
deb78b78cf Define fast Rectangle.create() and use it internally where applicable. 2011-03-06 18:45:56 +00:00
Jürg Lehni
4070f98374 Clean up calculateBounds(). 2011-03-06 18:33:52 +00:00
Jürg Lehni
836da3ce47 Make getCurrentSegment() a real private. 2011-03-06 15:21:12 +00:00
Jürg Lehni
dfb11610e7 Define getCurrentSegment() as private and make sure it's not used as a bean. 2011-03-06 15:17:06 +00:00
Jürg Lehni
162dab66a7 Clean up code. 2011-03-06 15:15:21 +00:00
Jürg Lehni
e533b4edbb Move PostScript commands to the end of Path definition in its own injection block. 2011-03-06 15:15:13 +00:00
Jürg Lehni
f803e1ad1d Remove obsolete comment. 2011-03-06 15:14:57 +00:00
Jürg Lehni
501e42fb9d Add Path#getLength(). 2011-03-06 14:58:10 +00:00
Jürg Lehni
8b32aa9f09 Reactivate commented out code in addBevelJoin(), since it is required in some situations. 2011-03-06 14:51:46 +00:00
Jürg Lehni
78c7f645ab Merge remote-tracking branch 'origin/master' 2011-03-06 14:45:57 +00:00
Jürg Lehni
2df6dc989a Add comments about changes that need backporting to Scriptographer. 2011-03-06 14:45:44 +00:00
Jürg Lehni
f6a8de8cc6 Finish work on miter caps for Path#getStrokeBounds. 2011-03-06 14:45:32 +00:00
Jürg Lehni
15b16aaed9 Add Line class to basics. 2011-03-06 14:45:07 +00:00
Jonathan Puckey
130d9ebb23 Merge remote branch 'origin/master' 2011-03-06 15:45:03 +01:00
Jürg Lehni
8be1041011 Make style setter calls chainable. 2011-03-06 14:44:54 +00:00
Jonathan Puckey
40b7571489 Move BlendMode into util and add missing var. 2011-03-06 15:44:51 +01:00
Jürg Lehni
2c034475b0 Fix a bug in Point#cross(). 2011-03-06 14:26:23 +00:00
Jonathan Puckey
54c1f3d8b1 Fix Raster#setSize. 2011-03-06 15:08:41 +01:00
Jonathan Puckey
336c9e1441 Fix bug in setHidden where Item#visible was being interpreted as a bean. 2011-03-06 14:50:57 +01:00
Jürg Lehni
5507482d8f Add support for bevel joins to Path#getStrokeBounds, miter still pending. 2011-03-06 13:26:36 +00:00
Jürg Lehni
407b6d8d33 Add Curve#getPrevious / Next. 2011-03-06 13:26:09 +00:00
Jürg Lehni
de9a406dc0 Add support for all strokeCaps in getStrokeBounds, joins are still pending. 2011-03-06 13:11:25 +00:00
Jürg Lehni
15f124bd9c Link segments to their curves through Segment#getCurve(). 2011-03-06 13:11:04 +00:00
Jürg Lehni
eb09ec2442 Fix error in Curve evaluation. 2011-03-06 13:07:49 +00:00
Jürg Lehni
e19c3bf3c2 Define Curve#toString() and Curve#clone() 2011-03-06 12:56:47 +00:00
Jürg Lehni
f98de38451 Correct Segment#toString() 2011-03-06 12:56:30 +00:00
Jürg Lehni
d15bf94f8f Add curve evaluation methods, untested. 2011-03-06 12:52:13 +00:00
Jürg Lehni
00d58a3e61 Move Path#getCurveLength() to Curve#getLength() and update tests accordingly. 2011-03-06 12:29:17 +00:00
Jürg Lehni
3ca1e4a25e Always update segments when index is set, as segments list might have shifted in the meantime. 2011-03-06 12:25:08 +00:00
Jürg Lehni
909b2a22ba Begin implementing Path#curves list. 2011-03-06 12:24:15 +00:00
Jürg Lehni
474d79db17 Clean up Segment constructor and make sure internal point objects are never replaced, always updated instead. 2011-03-06 12:24:03 +00:00
Jürg Lehni
cb2e4aaa04 Imrove Point, Size and Rectangle constructors. 2011-03-06 12:15:15 +00:00
Jürg Lehni
fd0d409d9e More work on Path#getStrokeBounds(), unfinished. 2011-03-06 11:42:33 +00:00
Jürg Lehni
0a690788ef Allow chaining of Item transform functions. 2011-03-06 11:42:08 +00:00
Jürg Lehni
5a1d31bba7 Improve argument reading in PostScript drawing methods. 2011-03-06 11:23:21 +00:00
Jürg Lehni
56c10f9196 Fix Segment#getHandleIn/OutIfSet and a newly introduced drawing error in Path#draw. 2011-03-06 11:18:35 +00:00
Jürg Lehni
7bea7e36de Make use of new Segment#getHandleIn/OutIfSet() where we can. 2011-03-06 11:04:41 +00:00
Jürg Lehni
b98abeb416 Declare outX, outY outside of draw loop, as it is used from previous iteration. 2011-03-06 11:00:25 +00:00
Jürg Lehni
2d2fb400d9 Add comment about Point#isParallel not being very precise. 2011-03-06 10:58:26 +00:00
Jürg Lehni
72a1ba8e70 Activate beans for Segment and clean up bean / getter / setter mess for point / handleIn / handleOut. 2011-03-06 10:57:14 +00:00
Jürg Lehni
e892d4446a More variable definition chaining. 2011-03-06 10:15:06 +00:00
Jürg Lehni
49e828ab9d Use chained variable definitions wherever we can to save space. 2011-03-06 10:14:12 +00:00
Jürg Lehni
3a51acec88 Begin implementing Path#getStrokeBounds(). 2011-03-06 10:09:37 +00: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
af909238eb Shorten code a bit. 2011-03-05 21:08:32 +00:00
Jürg Lehni
4dbba5f806 Make sure rectangle dimensions are not undefined when creatig from a Point or Size. 2011-03-05 21:06:23 +00:00
Jürg Lehni
5392268b83 Remove Raster/PlacedSymbol specific code form Matrix#transformBounds() and use Rectangle#setCenter() instead to center the bounds rectangle on the origin. 2011-03-05 21:05:07 +00:00
Jürg Lehni
06ca80573a Allow chaining of all Matrix calls without returns. 2011-03-05 21:04:01 +00:00
Jürg Lehni
7fa53a2db3 Allow chaining of Size setters. 2011-03-05 20:59:06 +00:00
Jürg Lehni
9f67f32701 Allow chaining of Point setters. 2011-03-05 20:58:46 +00:00
Jürg Lehni
a4c67a1bc1 Allow changing of Rectangle setters. 2011-03-05 20:57:45 +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
cfb7d195c0 Use the new statics: true setting for Base injection, and fix Array.prototype.slice issue in Base.read(). 2011-03-05 14:23:42 +00:00
Jürg Lehni
3f0a45a7c2 Allow Rasters to be created directly from id strings. 2011-03-05 14:17:32 +00:00
Jürg Lehni
8e25a951bc Move Base.capitalize() and Base.read() out of Bootstrap core into Paper.js, so normal Bootstrap libs can work with it too. 2011-03-05 14:17:17 +00:00
Jürg Lehni
352b3f0d40 More work on Bootstrap core, move Base.isArray back to Array.isArray. 2011-03-05 13:53:18 +00:00
Jürg Lehni
cc134de058 Remove trailing collon. 2011-03-05 13:51:23 +00:00
Jürg Lehni
836ee492ae More beans related refactoring. 2011-03-05 02:40:38 +00:00
Jürg Lehni
b06bf88aed More beans clean-up in Rectangle. 2011-03-05 01:59:15 +00:00
Jürg Lehni
e87e7b2582 Move get/setContext to get/setCanvas. 2011-03-05 01:59:01 +00:00
Jürg Lehni
a365bf45a4 Apply the same optimisation from previous commit to Layer. 2011-03-05 01:53:32 +00:00
Jürg Lehni
02bf012aa5 Simplify #appendTop / Bottom and #moveAbove / Bellow by using generator functions. 2011-03-05 01:50:56 +00:00
Jürg Lehni
083a9864f0 Use Matrix#transformBounds() in DocumentView#getBounds(). 2011-03-05 01:42:24 +00:00
Jürg Lehni
4908ba5edf Expand shortened name. 2011-03-05 01:37:02 +00:00
Jürg Lehni
ce74516228 Remove more beans access, this time related to various PathStyle getters / setters. 2011-03-05 01:36:27 +00:00
Jürg Lehni
c313e702c9 Clean up a whole lot of beans access, and in the process of the refactoring improve canvas, context, size and bounds handling in Raster and PlacedSymbol. 2011-03-05 01:26:12 +00:00
Jürg Lehni
b1027dbb38 Use better variable name. 2011-03-05 00:24:32 +00:00
Jürg Lehni
1d858147ec Stop using style beans internally. 2011-03-05 00:23:16 +00:00
Jürg Lehni
1d866ecb6c Clean up internal properties and beans in Color related classes. 2011-03-05 00:16:26 +00:00
Jürg Lehni
44ab8ed3a0 Refer to currentStyle through getters and setters, not through beans. 2011-03-05 00:03:28 +00:00
Jürg Lehni
4db061a048 Make sure Point is not using any beans internally. 2011-03-05 00:03:11 +00:00
Jürg Lehni
815e35fda6 Fix Segment#toString(). 2011-03-04 23:55:49 +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
8d5024523c Add Path#first/lastSegment. 2011-03-04 23:33:37 +00:00
Jürg Lehni
298dc912f3 Convert Tool to using new Events object instead of realing on full Bootstrap. 2011-03-04 23:32:46 +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
c25db2377f Clean up Bootstrap core further and move Base.capitalize there. 2011-03-04 22:14:23 +00:00
Jürg Lehni
996af95ba3 Inline Bootstrap core into paper scope. 2011-03-04 22:03:43 +00:00
Jürg Lehni
7355c2d4a7 Switch to using Base.isArray. 2011-03-04 21:47:00 +00:00
Jürg Lehni
aa4892c0d8 Apply same optimisations from DOM methods in Item / Layer to Segment too. 2011-03-04 21:34:31 +00:00
Jürg Lehni
be6d60102c Make sure Item#children is always checked for != null and simplify many of the DOM methods. 2011-03-04 21:34:14 +00:00
Jürg Lehni
e66dd46b9c Start improving Item#clone() / #copyTo(). 2011-03-04 20:57:16 +00:00
Jürg Lehni
f3663c04fe Compress code using Base.each side-car. 2011-03-04 20:55:11 +00:00
Jürg Lehni
1bd0127ece Remove dependency from full Bootstrap. 2011-03-04 20:54:57 +00:00
Jürg Lehni
93c3920505 Add definition of Base.capitalize() and remove dependencies of String#capitalize(). 2011-03-04 19:46:41 +00:00
Jürg Lehni
702899b382 Fix a bug in #getFixedDistance() where equals was used on numbers (Java port left-over). 2011-03-04 19:16:25 +00:00
Jonathan Puckey
acb6e850a0 Use toCssString() in Color#getCanvasStyle. 2011-03-04 18:14:24 +01:00
Jürg Lehni
fb547a758f Merge remote-tracking branch 'origin/master' 2011-03-04 16:55:01 +00:00
Jonathan Puckey
ff5ee13ba0 Fix Color#getCanvasStyle. 2011-03-04 17:54:36 +01:00
Jürg Lehni
66f5fcc847 Merge paper.js and build.js, to make sure the global paper object exists also when including seperate files during development and when running tests. 2011-03-04 16:52:17 +00:00
Jonathan Puckey
d54c30b9be Avoid using beans in Rectangle.js 2011-03-04 16:18:42 +01: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
c6d79f964c Generalise all read() functions in Base.read(), fix an issue in by making sure arguments passed to initialie are never larger than length, and have Color's initialize create an RGBColor, to still be able to use Color.read(). 2011-03-04 13:19:07 +00:00
Jonathan Puckey
3837ca1f14 Have Path#setSegments convert elements in the passed array to segments. 2011-03-04 13:02:11 +01:00
Jonathan Puckey
c00f85c9e5 Merge remote branch 'origin/master' 2011-03-04 12:21:06 +01:00
Jonathan Puckey
81c5e0e4c8 Fix ToolHandler#getFixedDistance. 2011-03-04 12:20:53 +01: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
6619447aa1 Convert ToolEvent type constants to Sg-style hyphenated lowercase strings. 2011-03-03 23:06:53 +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
08970abd6d Let paper.install() override existing values... 2011-03-03 18:31:18 +00:00
Jürg Lehni
cbe29fd02b Rename Color#getCssString() to #toCssString(), to go with #toString(). 2011-03-03 17:36:53 +00:00
Jürg Lehni
2f63a65ded Clean up code. 2011-03-03 17:35:59 +00:00
Jürg Lehni
46a0589547 Use Error constructor correctly. 2011-03-03 17:29:40 +00:00
Jürg Lehni
484d74160b Set private properties directly in initialize(), no need to call setters. 2011-03-03 17:27:56 +00:00
Jürg Lehni
0efc23b25c Remove 2nd redundant definition of Gradient#getStops(). 2011-03-03 17:26:30 +00:00
Jürg Lehni
7e52355f93 Rename Doc -> Document since paper code is namespaced now and does not clash with global Document prototype. 2011-03-03 17:23:27 +00:00
Jürg Lehni
fe1a01ecb6 Move paper.populate() functionality back to build.js. 2011-03-03 17:11:14 +00:00
Jürg Lehni
9a9cb91f72 Use the faster Point/Size.create() constructors across the basic classes for higher performance. 2011-03-03 17:07:12 +00:00
Jürg Lehni
dca26949ff Add Size.create(), in analogy to Point.create(). 2011-03-03 17:06:35 +00:00
Jürg Lehni
5508e6eab6 Change scoped compilation of paper so that only a populated paper object is returned to the global scope, but nothing is installed yet. 2011-03-03 16:57:29 +00:00
Jürg Lehni
59dc0ae6d0 Make sure paper.* objects are only installed in the passed object if there is not already something under the same name. 2011-03-03 16:38:04 +00:00
Jürg Lehni
e9881c02fc Merge remote-tracking branch 'origin/master' 2011-03-03 16:33:01 +00:00
Jürg Lehni
5ed30d7089 Make sure all files end on empty line. 2011-03-03 16:32:55 +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
aed8b0a6bc Add utility objects to build. 2011-03-03 16:32:15 +00:00
Jürg Lehni
d088dc629e Rename Paper to paper, implement it as an object literal and add paper.populate() and paper.install() methods that do the bootstraping. 2011-03-03 16:21:17 +00:00
Jonathan Puckey
00bf9aa88c Fall back to Item#bounds if the Item doesn't have Item#strokeBounds in Item#draw. 2011-03-03 17:05:12 +01:00
Jürg Lehni
6923e168ab Scope the compilation of the whole library and inject produced classes into global scope for now, add options later. 2011-03-03 14:09:20 +00:00
Jürg Lehni
80a5e4513e Add preprocessor and build scripts for production of single file Paper.js version, based on previous work for Bootstrap. 2011-03-03 13:45:21 +00:00
Jonathan Puckey
2f9531810c Implement todos about using strokeBounds instead of bounds. 2011-03-03 14:43:37 +01:00
Jürg Lehni
941c3c7346 Declare all classes as local variables, so they can be scoped. 2011-03-03 13:33:41 +00:00
Jürg Lehni
c84df5a346 Use Segment.read() correctly in Path#initialize(). 2011-03-03 13:16:14 +00:00
Jürg Lehni
3a46ac3b54 Allow read() methods to receive an optional length parameter. 2011-03-03 13:15:55 +00:00
Jürg Lehni
ecbd52cdf7 Fix Path.Line() constructor with 4 arguments. 2011-03-03 13:10:29 +00:00
Jürg Lehni
e089e080c2 Make Path#_add() handle both addition and insertion, and use it consequently so segment.path always gets correctly set. 2011-03-03 13:10:17 +00:00
Jürg Lehni
9a2462d147 No need to explicitely call Point#toString() in Segment#toString(). 2011-03-03 13:03:57 +00:00
Jürg Lehni
d4d6d652ec Rename Path#addSegment() to #_add(), to make sure it's supposed to be a private method. 2011-03-03 12:51:47 +00:00
Jürg Lehni
53b091b871 Rename #transformContent() to #_transform(), to make sure it's supposed to be a private method. 2011-03-03 12:47:55 +00:00
Jürg Lehni
1f29f6f104 Improve formating. 2011-03-03 12:46:50 +00:00
Jürg Lehni
b29a87653d Replace % 2 with & 1 (modulo 2). 2011-03-03 12:46:31 +00:00
Jürg Lehni
231343c6a2 Fix context orientation bug correct proberly, by flipping shear values instead of scale values. 2011-03-03 12:34:55 +00:00
Jürg Lehni
490ef78b53 Fix error in CompoundPath#closePath(): Forgot to pass 'this' to getCurrentPath(). 2011-03-03 12:26:28 +00:00
Jürg Lehni
1d37c7b76f Use 'that' variable for private instance method. 2011-03-03 12:25:41 +00:00
Jürg Lehni
26ebe2f2c0 Refacture CompoundPath to only use injection scope for methods that require getCurrentPath(). 2011-03-03 12:23:46 +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
Jürg Lehni
54bb4d5527 Merge remote-tracking branch 'origin/master' 2011-03-03 10:55:39 +00:00
Jürg Lehni
964dc462e9 Add comments to Path#strokeBounds and scafolding for #controlBounds too. 2011-03-03 10:55:35 +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
91ec37de9c Add foundations for Path#strokeBounds support. 2011-03-02 17:27:20 +00:00
Jürg Lehni
620cb2c754 Various clean-ups in Path. 2011-03-02 17:23:45 +00:00
Jürg Lehni
dbbefa9526 index on master: fd4b7b7 Include DocumentView.js in all examples and tests. 2011-03-02 16:22:26 +00:00
Jürg Lehni
ab9d07501e Simplify code a bit, by chainging variable declarations. 2011-03-02 16:08:11 +00:00
Jürg Lehni
5d680b1987 Reformat code and add comment about clearRect dimensions. 2011-03-02 16:07:44 +00:00
Jürg Lehni
f9346a3b7a Simplify code by merging setTransform() / transform() call to one. 2011-03-02 16:06:06 +00:00
Jürg Lehni
8cb3efb28e Simplify calculation of total in getAverageColor(). 2011-03-02 08:53:38 +01:00
Jürg Lehni
98de3cbb2a Simplify getAverageColor() loop. 2011-03-02 08:52:39 +01:00
Jürg Lehni
8c96d91400 Fix errors introduced by bad merge. 2011-03-02 08:52:13 +01:00
Jürg Lehni
3f972be500 Merge remote-tracking branch 'origin/master'
Conflicts:
	src/basic/Matrix.js
	src/item/Raster.js
2011-02-28 23:27:03 +01:00
Jürg Lehni
a93156ec45 Break long lines at 80 chars. 2011-02-28 20:24:15 +01:00
Jürg Lehni
caa6e8f88e Add comment about necessity to write more comments (nudge nudge, wink wink). 2011-02-28 20:23:03 +01:00
Jürg Lehni
aca79fc6a9 Simplify and optimise bounds calculations in Raster#transformContent(). 2011-02-28 20:22:11 +01:00
Jürg Lehni
0305c91e8c Change array format. 2011-02-28 20:21:21 +01:00
Jürg Lehni
d442ab1d71 Replace * 0.5 optimisations with more obvious / 2, as there is no need for such optimisation here. 2011-02-28 20:20:44 +01:00
Jürg Lehni
c3d02bbd16 Add explanatory comments to Raster#transformContent(). 2011-02-28 20:17:59 +01:00
Jürg Lehni
763fc95776 Fix odd issue of Rasters rotating the wrong way, which seems to be caused by Canvas not using the same Matrix orientation as Paper.js (scaleX (m00) and scaleY (m11) need to be flipped). 2011-02-28 20:15:40 +01:00
Jürg Lehni
700f4aeb6a Add #set() function to Point, Rectangle and Size (Matrix has it already). 2011-02-28 20:14:10 +01:00
Jonathan Puckey
14b8452bad Fix mistakes in Tool.js 2011-02-28 19:29:32 +01:00
Jonathan Puckey
1261dc03df Doc: point to the correct performance test url. 2011-02-28 18:41:46 +01:00
Jonathan Puckey
eee5e63a72 BlendMode: support DocumentView and return if an item's bounds is null. 2011-02-28 18:36:06 +01:00
Jonathan Puckey
0e011dee2a Support DocumentView in Group#draw. 2011-02-28 18:35:12 +01:00
Jonathan Puckey
fe9853852a Implement new Doc(size) constructor, Doc#views / Doc#activeView and support DocumentView in Doc#redraw. 2011-02-28 18:34:39 +01:00
Jonathan Puckey
285f81f363 Support PlacedSymbol opacity. 2011-02-28 18:31:51 +01:00
Jonathan Puckey
4fa293ec6d Have Tool convert points from view coordinates to artwork coordinates. 2011-02-28 18:31:03 +01:00
Jonathan Puckey
74f797a9dd Clean up whitespace. 2011-02-28 18:30:08 +01:00
Jonathan Puckey
84e31925b6 Implement DocumentView. 2011-02-28 18:28:16 +01:00
Jonathan Puckey
a7429205ed Allow Matrix#applyToContext to optionally reset the matrix transformation. 2011-02-28 18:27:57 +01:00
Jonathan Puckey
12859d7a24 Item: pass on param object to Item#draw. 2011-02-28 16:41:24 +01:00
Jonathan Puckey
c6d606db0a Path: After calling Path#add(segment), return the added segment. Add todo to Path#insert. 2011-02-27 15:50:41 +01:00
Jonathan Puckey
9496ac70bd Clean up Path.RegularPolygon constructor. 2011-02-26 19:21:52 +01:00
Jonathan Puckey
eebe7e2731 Implement Path.RegularPolygon constructor and add tests for it. 2011-02-26 19:19:02 +01:00
Jürg Lehni
506e7c036c Merge remote-tracking branch 'origin/master' 2011-02-26 17:27:12 +01:00
Jürg Lehni
b1b923ab27 Add comment about problems with Base.clone(). 2011-02-26 17:27:07 +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
461aa87211 Group: add todo. 2011-02-26 15:55:58 +01:00
Jonathan Puckey
9e6fd5a7e7 Speed up CanvasProvider. 2011-02-26 15:29:51 +01:00
Jonathan Puckey
1a6c5c8c6f Doc: Change comment about using canvas.width = canvas.width instead of context.clearRect. 2011-02-26 14:38:50 +01:00
Jonathan Puckey
422b8911b8 Fix PlacedSymbol#transformContent. 2011-02-26 13:33:13 +01:00
Jonathan Puckey
22bccf3a31 Tool: Fix issue with onMouseMove being called while the user is dragging the mouse. 2011-02-26 13:00:55 +01:00
Jonathan Puckey
51f4ee718c As in Scriptographer, we don't worry if there wasn't a moveTo before the first lineTo. 2011-02-26 12:44:09 +01:00
Jonathan Puckey
71bf8dba88 Item: remove logging statement. 2011-02-26 02:04:18 +01:00
Jonathan Puckey
8828ed7e25 CompoundPath - check for this.blendMode != 'normal'. 2011-02-26 01:02:17 +01:00
Jonathan Puckey
bebc8bc8cc Another attempt at fixing Item#transformContent. The bounds are correctly calculated now, but Item#rotate rotates the items in the wrong direction and rotating by a point doesn't work well. 2011-02-26 00:58:54 +01:00
Jonathan Puckey
f79e6a0454 PlacedSymbol & Raster: fix transformContent and support BlendMode. 2011-02-25 19:38:55 +01:00
Jonathan Puckey
049504a67a Changed BlendMode library from code ported from Pixastic to code ported from Gavin Kistner's Context Blender Javascript Library. 2011-02-25 18:37:46 +01:00
Jonathan Puckey
c47a18ea58 BlendMode: add todo about using Item#strokeBounds instead of Item#bounds. 2011-02-25 13:57:01 +01:00
Jonathan Puckey
1c364601b4 Added todo about supporting BlendMode for PlacedSymbols. 2011-02-25 13:28:35 +01:00
Jonathan Puckey
ec0b1dec1d PlacedSymbol: add missing param object to PlacedSymbol#definition#draw call. 2011-02-25 13:13:46 +01:00
Jonathan Puckey
c9d04d33f8 Implement BlendMode class. 2011-02-25 12:47:52 +01:00
Jonathan Puckey
d9b75a7232 Implement Item#reverseChildren() and add tests for it. 2011-02-24 19:31:07 +01:00
Jonathan Puckey
d77741db4f Implement item#rasterize(resolution). 2011-02-24 19:22:19 +01:00
Jonathan Puckey
014d1053a7 Fix Item#isDescendant / Item#isAncestor, implement Item#isGroupedWith and add tests. 2011-02-24 18:09:48 +01:00
Jonathan Puckey
6cea290dd8 Item: add todo's for missing functionalities. 2011-02-24 17:42:32 +01:00
Jonathan Puckey
4d83631230 Segment: remove todo. 2011-02-24 17:14:59 +01:00
Jonathan Puckey
f65625b591 Change CompoundPath#moveBy to be relative to the previous position in lack of an argument. 2011-02-24 17:13:41 +01:00
Jonathan Puckey
ad82be1bec Add CompoundPath#bounds 2011-02-24 17:11:02 +01:00
Jonathan Puckey
95f9028091 Add Point#clone docs to Point.js. 2011-02-24 14:31:32 +01:00
Jonathan Puckey
ebbf8cf039 Add missing introduction to Point.js 2011-02-24 14:30:06 +01:00
Jonathan Puckey
a3ec524722 Add documentation from Point.java to Point.js, remove TODO about adding back center support to Scriptographer for Point#rotate, since it is already there. 2011-02-24 14:28:44 +01:00
Jonathan Puckey
d37a794b64 Simplify Raster#initialize, set _size in Raster#setCanvas and add todo. 2011-02-24 14:15:30 +01:00
Jonathan Puckey
ff2ac484da Raster: add todo and perform small cleanup. 2011-02-24 13:56:27 +01:00
Jonathan Puckey
d564be8a7e Implement new Raster(canvas) / Raster#getSubImage / Raster.drawImage / Raster.ppi. 2011-02-24 13:52:27 +01:00
Jonathan Puckey
f88fcd3049 Implement Point#transform(matrix). 2011-02-24 13:48:24 +01:00
Jonathan Puckey
73df06150a Fix RGBColor#setGray. 2011-02-24 12:58:16 +01:00
Jonathan Puckey
2712bd0419 Fix mistake in Raster. 2011-02-24 02:39:33 +01:00
Jonathan Puckey
41f3f47dd3 Fix small mistakes in Raster. 2011-02-24 01:51:49 +01:00
Jonathan Puckey
83b8a3e815 Optimize CanvasProvider to only expect a Size object. 2011-02-24 01:36:38 +01:00
Jonathan Puckey
c929bacde8 Clean up Group#draw and save/restore context state when drawing group with opacity. 2011-02-24 01:33:36 +01:00
Jonathan Puckey
dc51384a1a Allow CanvasProvider to receive sizes too. 2011-02-24 01:29:51 +01:00
Jonathan Puckey
f1cd24eef8 More work on Raster, including getAverageColor, get/setPixel, get/setSize. 2011-02-24 01:28:11 +01:00
Jürg Lehni
0d53167926 Simplify calculation of bezier polynomial derivative, by dividing all factors by 3. 2011-02-22 10:39:05 +01:00
Jürg Lehni
614f9998de More optimisations in Path#getBounds(). 2011-02-22 10:35:48 +01:00
Jürg Lehni
a08e3dc366 Optimise Path#getBounds() by merging internal f() and bounds() functions and thus reducing calls. 2011-02-22 10:33:46 +01:00
Jürg Lehni
452b1e2792 Add explanations to Path#getBounds(). 2011-02-22 10:25:18 +01:00
Jürg Lehni
e1bcd70059 Simplify Raster#draw(). 2011-02-22 02:27:40 +01:00
Jonathan Puckey
689ddf7555 Raster: implement getPixel and create beans for Raster#canvas and Raster#context that create a canvas object / context when called for the first time. 2011-02-21 19:52:41 +01:00
Jonathan Puckey
cd5b2a7198 PlacedSymbol/ Raster: Use Matrix#applyToContext in draw functions. Also clean up Raster a bit. 2011-02-21 19:04:51 +01:00
Jonathan Puckey
5a786c300b Implement Matrix#applyToContext. 2011-02-21 19:03:57 +01:00
Jonathan Puckey
53b0f8a329 Update comments about implementing getAverageColor(path). 2011-02-21 18:49:44 +01:00
Jonathan Puckey
9324b9918d Implement part of Raster.js 2011-02-21 18:43:56 +01:00
Jonathan Puckey
d0c2c5dd1d Add todo about speeding up canvas clearing. 2011-02-21 03:52:28 +01:00
Jonathan Puckey
b9d37e1b9b Only draw a CompoundPath if it is visible. 2011-02-21 03:52:03 +01:00
Jonathan Puckey
357a8af6ec Clean up white spaces. 2011-02-21 03:32:39 +01:00
Jonathan Puckey
4c84379b5b Remove unused variable. 2011-02-21 03:26:46 +01:00
Jonathan Puckey
514fe1f0e6 Implement group opacity by drawing onto a second canvas first. 2011-02-21 03:22:42 +01:00
Jonathan Puckey
6fcdb86e1c Implement CanvasProvider that provides reusable canvas elements. 2011-02-21 03:17:09 +01:00
Jonathan Puckey
3cd680c5f0 Merge remote branch 'origin/master' 2011-02-21 01:17:26 +01:00
Jonathan Puckey
5e271359b9 Add todo. 2011-02-21 01:16:53 +01:00
Jürg Lehni
77f1e22727 Merge remote-tracking branch 'origin/master' 2011-02-21 00:28:48 +01:00
Jürg Lehni
8cdd7fe2b2 Remove unnecessary call of new Point(). 2011-02-21 00:28:36 +01:00
Jürg Lehni
dc410b6894 Merge rotateAround() and rotate(). 2011-02-21 00:28:13 +01:00
Jonathan Puckey
14943f428f Remove logging statement. 2011-02-21 00:27:02 +01:00
Jonathan Puckey
5dcf416a7a Merge remote branch 'origin/master' 2011-02-21 00:26:03 +01:00
Jonathan Puckey
0458e3d916 Check for null in Color#read. 2011-02-21 00:25:45 +01:00
Jürg Lehni
2ebe4a18da Add Point#isInside(). 2011-02-21 00:24:17 +01:00
Jürg Lehni
04d2ed29c6 Move private createPoint() to Point.create(). 2011-02-21 00:23:36 +01:00
Jonathan Puckey
245c1e9b90 Merge remote branch 'origin/master' 2011-02-20 23:51:56 +01:00
Jürg Lehni
9aabf30800 Optimise Point code more by using an internal createPoint method that bypasses initialize completely. 2011-02-20 23:41:39 +01:00
Jonathan Puckey
4c4b8246ee Make sure the whole canvas is cleared. 2011-02-20 23:31:33 +01:00
Jonathan Puckey
51ab66b0f8 Remove trailing comma in ToolEvent. 2011-02-20 21:22:31 +01:00
Jonathan Puckey
f83309d6b7 Optimize Path#draw. 2011-02-20 20:47:13 +01:00
Jonathan Puckey
cb40d3f6f4 Implement Symbol and PlacedSymbol. Add Document#symbols array. 2011-02-20 18:34:38 +01:00
Jürg Lehni
3374e50def Yet another optimisation in Path#transformContent(): Only transform handles if they are not [0, 0]. 2011-02-20 11:20:23 +01:00
Jürg Lehni
98837cbe98 Further optimise Path#transformContent() by reusing arrays and thus reducing memory footprint. 2011-02-20 11:15:40 +01:00
Jürg Lehni
c89d04dca6 Optimise Path#getBounds() by not relying on Point#add() but instead doing the calculations in direct math in the per-coordinate loop. 2011-02-20 02:05:40 +01:00
Jürg Lehni
6c4121db4b Optimise Path#transformContent() by using Matrix#transform() version that handles arrays of multiple point values for much improved performance. 2011-02-20 01:55:43 +01:00
Jürg Lehni
ed752ed744 Pass ctor.dont to all constructor calls that are followed with explicit initialize() calls afterwards, to make sure it is only called once. 2011-02-20 01:45:53 +01:00
Jonathan Puckey
c0a93a8b66 Setters already handle point conversion. 2011-02-19 22:52:00 +01:00
Jonathan Puckey
10623ddb62 Implement Gradient, GradientColor, GradientStop. 2011-02-19 22:50:37 +01:00
Jonathan Puckey
95fa61f1ba Group: remove unneeded ctx commands. 2011-02-19 18:10:26 +01:00
Jonathan Puckey
a1bec86333 Have Layer extend Group. 2011-02-19 18:09:14 +01:00
Jonathan Puckey
57b7b364bc Nullify cssString cache when color/alpha values change. 2011-02-19 18:01:08 +01:00
Jonathan Puckey
2b1dee1bd4 Add opacity support in Path#draw. 2011-02-19 17:33:23 +01:00
Jonathan Puckey
c2849b3692 Change PathStyle, CompoundPath and Path to work with new Color classes. 2011-02-19 17:25:16 +01:00
Jonathan Puckey
c386f38b86 GrayColor: fix comment. 2011-02-19 17:22:20 +01:00
Jonathan Puckey
068c4dc1ca Add missing Color.js. 2011-02-19 17:10:26 +01:00
Jonathan Puckey
b944b82abe GrayColor: fix comments. 2011-02-19 17:08:08 +01:00
Jonathan Puckey
66105dd4ac Implement Color, RGBColor & GrayColor. 2011-02-19 17:05:39 +01:00
Jonathan Puckey
bd5c906047 Fix error in CompoundPath. 2011-02-19 14:12:05 +01:00
Jonathan Puckey
8af671bb41 Merge remote branch 'origin/master' 2011-02-19 14:07:26 +01:00
Jürg Lehni
451eaaa3c6 Add a TODO comment. 2011-02-19 13:07:24 +01:00
Jürg Lehni
6093151a3b Make sure that setting styles explicitely to null works. 2011-02-18 08:04:20 +00:00
Jürg Lehni
d02b5cd56a Yet another optimisation, by using the Base.each() sidecar (bind object) to fill Item fields, and inject it straight away upon returning from it. 2011-02-18 07:58:59 +00:00
Jürg Lehni
31b595fa9e Rename itemProps to itemFields, for more consistency. 2011-02-17 23:47:04 +00:00
Jürg Lehni
2c06ec965c Simplify PathStyle further, by removing the _get/_setChildrenStyle methods and moving their functionality into the closure injection code. 2011-02-17 23:37:21 +00:00
Jürg Lehni
4e05faaa11 Use the same simplifications in PathStyle as in CompoundPath, and rely on Base.each as well to provide the scope for closure injection. 2011-02-17 23:34:45 +00:00
Jürg Lehni
b14c9ae21b For the closure injection to work properly we need an iterator function that provides a scope to the referenced key value. Rely on Base.each() for this, which even in a scaled down Bootstrap will be available and not harmful, as it won't rely on modified native prototypes. 2011-02-17 23:34:03 +00:00
Jürg Lehni
bc33ae8084 Add missing #closePath() to both Path and CompoundPath. 2011-02-17 23:01:18 +00:00
Jürg Lehni
4c2e1ee5c9 Optimise and simplfy CompoundPath code, by moving scope into extend() call, and only compiling one fields object inside it that is return at the end. 2011-02-17 22:58:56 +00:00
Jürg Lehni
e6dc189310 Simplify injection separation by using multiple arguments to extend(). 2011-02-17 22:46:28 +00:00