Canvas.getContext

Syntax

getContext();

Description

The getContext method returns canvas context.

Comments

Context is an object that presents methods and properties used to render canvas elements.

Example

To execute the example the page must contain the Canvas component named canvas (see Example of Creating the Canvas Component). Get canvas context font parameters:

// Get canvas context font parameters
console.log("Canvas context font parameters: " + canvas.getContext().font);

As a result the console displays canvas context font parameters:

Canvas context font parameters: 10px sans-serif

See also:

Canvas