HTML and CSS Reference
In-Depth Information
mycontext.stroke();
mycontext. restore (); // back to previous <canvas> state
mycontext.beginPath();
mycontext.moveTo(80, 10);
mycontext.lineTo(14, 50);
mycontext.stroke();
Figure 9-12. Coordinate system transformations and stack management of the canvas state
See Also
See the W3C specification for canvas transformations at http://www.w3.org/TR/2dcon
text/#transformations .
9.8 Placing Text on a <canvas>
Problem
You want to include text directly in your canvas drawing.
Solution
The canvas API provides two commands for rendering text in your drawing: fill
Text(...) and strokeText(...) . Both commands take the same parameters: ( stringTo
Render , x , y [, maxWidth ]) . The only difference is whether the text is filled in or simply
outlined.
 
Search WWH ::




Custom Search