CanvasRenderingContext2D: the object used for drawing on a canvas — Firefox 1.5, Safari 1.3, Opera 9: Object → CanvasRenderingContext2D


readonly Canvas canvas

The Canvas element upon which this context will draw.

Object fillStyle

The current color, pattern, or gradient used for filling paths. This property may be set to a string or to a CanvasGradient or CanvasPattern object. When set to a string, it is parsed as a CSS color value and used for solid fills. When set to a CanvasGradient or CanvasPattern object, fills are done using the specified gradient or pattern. See CanvasRenderingContext2D.createLinearGradient( ), CanvasRenderingContext2D.createRadialGradient( ), and CanvasRenderingContext2D.createPattern( ).

float globalAlpha

Specifies the opacity of content drawn on the canvas. The range of values is between 0.0 (fully transparent) and 1.0 (no additional transparency). The default value for this property is 1.0.

String globalCompositeOperation

Specifies how colors being drawn are combined (or “composited”) with colors already on the canvas. See the individual reference entry for this property for possible values.

String lineCap

Specifies how the ends of lines are rendered. Legal values are “butt”, “round”, and “square”. The default is “butt”. See the individual reference page for this property for further details.

String lineJoin

Specifies how two lines are joined. Legal values are “round”, “bevel”, and “miter”. The default is “miter”. See the individual reference ...

Get JavaScript: The Definitive Guide, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.