CanvasMemory is a project mainly written in JavaScript, it's free.
HTML5 Canvas wrapper adding methods to access current transform matrix and drawing path.
wrapper around canvas 2d context adding methods to access current transform matrix and drawing path. Handful mostly in generative graphic, creative coding etc.
License: MIT.
API:
Example:
// init
var canvas = document.querySelector('#test_canvas');
var ctx = canvas.getContext('2d');
var memctx = new CanvasMemory().applyTo(ctx);
// some standard canvas drawing methods
memctx.moveTo(10, 10);
memctx.lineTo(20, 20);
...
memctx.getCurrentCoords();
memctx.getCurrentOrigin();
memctx.getPointInCurrentMatrix(5, 5);
memcts.getTransform();
See also example.html
TODO:
Note: As it basically delegates each operation while duplicating some of the matrix calculations in the background, it's probably quite expensive. You should use it only if you really need to.