Technical Info on Safari's New DHTML Canvas Tag

Erik Arvidsson, the very talented DHTML hacker, has posted some interesting stuff about the new Safari canvas tag on the whatwg working list:

After some digging in the webcore source files online I found the following methods on the Context2D object which you get from the canvas element


save Arguments 0
restore Arguments 0
scale Arguments 2
rotate Arguments 2
translate Arguments 1
beginPath Arguments 0
closePath Arguments 0
setStrokeColor Arguments 1
setFillColor Arguments 1
setLineWidth Arguments 1
setLineCap Arguments 1
setLineJoin Arguments 1
setMiterLimit Arguments 1
fillPath Arguments 0
strokePath Arguments 0
moveToPoint Arguments 2
addLineToPoint Arguments 2
addQuadraticCurveToPoint Arguments 4
addBezierCurveToPoint Arguments 6
addArcToPoint Arguments 5
addArc Arguments 6
addRect Arguments 4
clip Arguments 0
clearRect Arguments 4
fillRect Arguments 4
strokeRect Arguments 4
drawImage Arguments 6
drawImageFromRect Arguments 10
setShadow Arguments 3
clearShadow Arguments 0
setAlpha Arguments 1
setCompositeOperation Arguments 1


See the complete source code.


This looks pretty good and seems very useful. One thing that struck me as wrong was that the colors could not be provided as HSB which is supported by CSS3 so it would make sense to allow that as well.



Comments