[whatwg] fxCanvas 0.2 and some remarks about canvas spec
Evgeny Burzak
buzzilo at gmail.com
Sat Nov 13 09:20:45 PST 2010
Hi,
I have just published new Canvas stub for IE (based on flash). I'm
using it in another my project - Drawform, to make it working under
IE.
Drawform: http://burzak.com/proj/drawform/
fxCanvas: http://burzak.com/proj/fxcanvas/
So I have some remarks about Canvas spec.
I faced some troubles when using default image data, because of in old
Explorers used extremely ineffective memory manager, so that I made
some tests and figure out that fastest and less memory consumption is
array with pixel colors encoded in 32-bit integer. Here is the test:
http://burzak.com/proj/fxcanvas/tests/data-structure-comparison.html
But , the test results looks similar for all vendors! On average the
difference in processing speed is about 2-3 times (five times in
Firefox 4). This is due to the fact that loops take less time (width x
height * 4 vs. width x height) and arrays with less elements take less
memory. Though I realize that main idea for data structure was
simplicity, but in this case it seems simplicity is evil, not good.
Another thing is reusable canvas path. I've added experimental class
CanvasPath and and some related methods to Canvas context.
For example:
var p = new CanvasPath() // I think first argument can be string from
SVG "d" attribute
p.moveTo(0, 0)
p.lineTo(10, 20)
ctx.beginPath()
ctx.appendPath(p)
... and so on. If you are interested in it, I can describe my idea futher...
This is quite useful thing, at least for me.
Evgeny
More information about the whatwg
mailing list