Closed georeith closed 8 years ago
We had this discussion before. There is no nice way to implement this with nested matrices and view transformations. I think this belongs into the code that uses paper.js, not into the library itself...
https://groups.google.com/forum/#!msg/paperjs/pqm9VCuXDnY/4MM8wGfjtJgJ
@lehni Even in the case where only the calls to CanvasRenderingContext2D
have their values rounded? Are they not post every transformation?
The issue with doing this externally is you have to maintain separate bounds for each item... the real ones you want to use for calculations and the lossy ones to render, where it feels like the library could do it far more efficiently. Especially as this is only a render time setting and thats solely performed by the library.
The transformations are applied to the canvas natively, unfortunately there is no way to tell it to round after transforming the coordinates internally. The only solution would be to perform all transformations in JS, but that's overkill.
Ah yeah that makes sense, yeah definitely that would be overkill. Thanks for explaining.
Would be useful to certain use cases to tell items to render at whole pixels to remove anti-aliasing.
They could still be allowed to have decimal bounds internally to maintain the spatial relationship of items within groups say. Purely a setting that would tell
item._draw
to round certain values so that its bounds are all integer values, things like bezier curves can still be allowed to draw on subpixels of course, only anchor points would be rounded.The setting is probably best defined at a Project level, to let you turn it on and off per view.
If this sounds like something you would like in the library I would be happy to make a fork and take a stab at implementing it.