What is a drawing context? What is the role of the getcontext () method?

What is a getContext()method and what is the drawing context for sure? why do we always pass a string to a 2dmethod getContext()?

+5
source share
2 answers

Context is a way to choose what you are going to do with your canvas.

For a minute you can use getContext for 2d (2dcanvas) or for 3d (WebGL).

The HTML5 specification talks about getContext: "Returns an object that provides an API for drawing on canvas. The first argument indicates the desired API. Subsequent arguments are processed by this API."

API: http://wiki.whatwg.org/wiki/CanvasContexts

, "webgl" API, , , "experimental-webgl", WebGL.

+5

(/), , , .

100 . (). , , ( ). .

: drawLine, drawPath, drawRect ( ).

: , , , , ..

(pardon the pun) , - 2d webgl 3D-.

0

All Articles