In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The editor today takes you to understand which HTML5 built-in object is used to draw on the canvas. The knowledge points in this article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem find the answer to the problem. Follow the editor to learn more about "which HTML5 built-in object is used to draw on the canvas".
In html5, the built-in object getContext () is used to paint on the canvas, and getContext () is used to get the rendering context and its drawing function, returning an environment for drawing on the canvas with the syntax "Canvas.getContext (contextID)".
The operating environment of this tutorial: windows7 system, HTML5 version, Dell G3 computer.
Which HTML5 built-in object is used to paint on the canvas? ()
A.getContent
B.getContext
C.getGraphics
D.getCanvas
Correct answer: B
The getContext () method is used to get the rendering context and its drawing capabilities, and returns an environment for drawing on the canvas. This function takes one parameter, the type of context 2d.
Grammar
Canvas.getContext (contextID)
Parameters.
The parameter contextID specifies the type you want to paint on the canvas. Currently the only legal value is "2d", which specifies a 2D drawing and causes this method to return an environment object that exports a 2D drawing API.
Tip: in the future, if the label is extended to support 3D drawing, the getContext () method may allow you to pass a "3D" string parameter.
Return value
A CanvasRenderingContext2D object that can be drawn into a Canvas element.
Description
Returns an environment that represents the type of environment used to draw. The original intention is to provide different environments for different types of rendering (2D, 3D). Currently, the only thing supported is "2d", which returns a CanvasRenderingContext2D object that implements most of the methods used by a canvas.
Example: the following is the code to get the desired context and to check that your browser supports elements:
Var canvas = document.getElementById ("mycanvas"); if (canvas.getContext) {var ctx = canvas.getContext ('2d'); / / draw the code here} else {/ / the canvas does not support the code here} Thank you for reading, this is the whole content of "which HTML5 built-in object is used to draw on the canvas", friends of the study hurry up to do it. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.