RenderingContext - Web APIs 编辑
RenderingContext
is a WebIDL typedef
which can refer to any one of the interfaces that represent a graphics rendering context within a <canvas>
element: CanvasRenderingContext2D
, WebGLRenderingContext
, or WebGL2RenderingContext
.
By using the shorthand RenderingContext
, methods and properties which can make use of any of these interfaces can be specified and written more easily; since <canvas>
supports several rendering systems, it's helpful from a specification and browser implementation perspective to have a shorthand that means "one of these interfaces."
As such, RenderingContext
is an implementation detail, and isn't something web developers directly use. There is no RenderingContext
interface, and there are no objects which implement type RenderingContext
.
The primary use of this type is the definition of the <canvas>
element's HTMLCanvasElement.getContext()
method, which returns a RenderingContext
(meaning it returns any one of the rendering context types).
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'RenderingContext' in that specification. | Living Standard | Initial definition. |
See also
- The rendering context interfaces:
CanvasRenderingContext2D
,WebGLRenderingContext
, andWebGL2RenderingContext
- Graphics on the Web
- Canvas API and
<canvas>
- WebGL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论