diff --git a/doc/canvas.md b/doc/canvas.md index 71f293141..bb41a98ab 100644 --- a/doc/canvas.md +++ b/doc/canvas.md @@ -2,7 +2,6 @@ Tabris.js Canvas ================ Canvas is a composite which allows the user to draw on it using a canvas context. Canvas context provides a drawing API. It is a subset of the HTML5 [CanvasRenderingContext2D](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D). -. To create the canvas context, invoke the following method: @@ -14,7 +13,17 @@ tabris.getContext(canvas, width, height); * width - the width of the drawable area * height - the height of the drawable area -*Pre-Release Note: This method will likely be moved to the canvas itself.* +Example: + +```javascript +tabris.create("Canvas", { + layoutData: {left: 0, top: 0, right: 0, bottom: 0} +}).on("change:bounds", function(canvas, bounds) { + var ctx = tabris.getContext(canvas, bounds.width, bounds.height); + ctx.moveTo(0, 0); + // ... +}).appendTo(page); +``` The following CanvasRenderingContext2D methods are supported: