HTML5元素的getCSSCanvasContext()方法是什么? [英] What is the getCSSCanvasContext() method of an HTML5 element?

查看:36
本文介绍了HTML5元素的getCSSCanvasContext()方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是 getCSSCanvasContext()方法?我在Chrome的调试控制台中看到了它,但找不到任何合适的文档.

What is the getCSSCanvasContext() method? I saw it in Chrome’s debuging console, but I cannot find any decent documentation for it.

这是否意味着我们可以在任何元素上使用画布命令进行绘制?

Does it mean we can draw using canvas commands on any element?

推荐答案

该方法是在WebKit中实现的(意味着您也可以在Safari中使用它),并返回一个对象,可让您绘制到CSS图像中.有关示例,请参见此博客文章:

The method is implemented in WebKit (meaning you can also use it in Safari) and returns an object that lets you draw into a CSS image. See this blog post for an example:

在最新的夜间活动中,您可以尝试一项新功能:在CSS中指定已命名的图像缓冲区,然后将其绘制通过JavaScript以编程方式进行.运作方式如下.

In the latest nightlies, you can try out a new feature: the ability to specify named image buffers in CSS and then to draw into them programmatically from JavaScript. Here’s how it works.

背景:-webkit-canvas(mycanvas);

您可以指定画布和一个而不是指定图像URL.用于该画布的标识符.以下有关文档的新API然后可以用来获取该画布的绘制上下文.

Instead of specifying an image URL, you specify a canvas and an identifier to use for that canvas. The following new API on documents can then be used to obtain a drawing context for that canvas.

CanvasRenderingContext getCSSCanvasContext(在DOMString contextType中,在DOMString标识符中,长宽度,长高度);

这篇关于HTML5元素的getCSSCanvasContext()方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆