HTML5 界面元素 Canvas 參考手冊
HTML5 界面元素 Canvas 參考手冊
太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es)
本文遵循“署名-非商业用途-保持一致”创作公用协议
HTML5 界面元素 Canvas 參考手冊
HTML Canvas Reference
描写叙述
Description
The HTML5 <canvas> tag is used to draw graphics, on the fly, via scripting (usually JavaScript).
However, the <canvas> element has no drawing abilities of its own (it is only a container for graphics) - you must use a script to actually draw the graphics.
The getContext() method returns an object that provides methods and properties for drawing on the canvas.
This reference will cover the properties and methods of the getContext("2d") object, which can be used to draw text, lines, boxes, circles, and more - on the canvas.
浏览器支持
Browser Support
Internet Explorer 9, Firefox, Opera, Chrome, and Safari support <canvas> and its properties and methods.
Note: Internet Explorer 8 and earlier versions, do not support the <canvas> element.
颜色、样式和阴影
Colors, Styles, and Shadows
|
Property |
Description |
|
Sets or returns the color, gradient, or pattern used to fill the drawing |
|
|
Sets or returns the color, gradient, or pattern used for strokes |
|
|
Sets or returns the color to use for shadows |
|
|
Sets or returns the blur level for shadows |
|
|
Sets or returns the horizontal distance of the shadow from the shape |
|
|
Sets or returns the vertical distance of the shadow from the shape |
|
Method |
Description |
|
Creates a linear gradient (to use on canvas content) |
|
|
Repeats a specified element in the specified direction |
|
|
Creates a radial/circular gradient (to use on canvas content) |
|
|
Specifies the colors and stop positions in a gradient object |
线条样式
Line Styles
|
Property |
Description |
|
Sets or returns the style of the end caps for a line |
|
|
Sets or returns the type of corner created, when two lines meet |
|
|
Sets or returns the current line width |
|
|
Sets or returns the maximum miter length |
矩形
Rectangles
|
Method |
Description |
|
Creates a rectangle |
|
|
Draws a "filled" rectangle |
|
|
Draws a rectangle (no fill) |
|
|
Clears the specified pixels within a given rectangle |
路径
Paths
|
Method |
Description |
|
Fills the current drawing (path) |
|
|
Actually draws the path you have defined |
|
|
Begins a path, or resets the current path |
|
|
Moves the path to the specified point in the canvas, without creating a line |
|
|
Creates a path from the current point back to the starting point |
|
|
Adds a new point and creates a line from that point to the last specified point in the canvas |
|
|
Clips a region of any shape and size from the original canvas |
|
|
Creates a quadratic Bézier curve |
|
|
Creates a cubic Bézier curve |
|
|
Creates an arc/curve (used to create circles, or parts of circles) |
|
|
Creates an arc/curve between two tangents |
|
|
Returns true if the specified point is in the current path, otherwise false |
转换
Transformations
|
Method |
Description |
|
Scales the current drawing bigger or smaller |
|
|
Rotates the current drawing |
|
|
Remaps the (0,0) position on the canvas |
|
|
Replaces the current transformation matrix for the drawing |
|
|
Resets the current transform to the identity matrix. Then runs transform() |
文本
Text
|
Property |
Description |
|
Sets or returns the current font properties for text content |
|
|
Sets or returns the current alignment for text content |
|
|
Sets or returns the current text baseline used when drawing text |
|
Method |
Description |
|
Draws "filled" text on the canvas |
|
|
Draws text on the canvas (no fill) |
|
|
Returns an object that contains the width of the specified text |
图像绘制
Image Drawing
|
Method |
Description |
|
Draws an image, canvas, or video onto the canvas |
像素操作
Pixel Manipulation
|
Property |
Description |
|
Returns the width of an ImageData object |
|
|
Returns the height of an ImageData object |
|
|
Returns an object that contains image data of a specified ImageData object |
|
Method |
Description |
|
Creates a new, blank ImageData object |
|
|
Returns an ImageData object that copies the pixel data for the specified rectangle on a canvas |
|
|
Puts the image data (from a specified ImageData object) back onto the canvas |
混合
Compositing
|
Property |
Description |
|
Sets or returns the current alpha or transparency value of the drawing |
|
|
Sets or returns how a new image are drawn onto an existing image |
其他
Other
|
Method |
Description |
|
save() |
Saves the state of the current context |
|
restore() |
Returns previously saved path state and attributes |
|
createEvent() |
|
|
getContext() |
|
|
toDataURL() |
HTML5 界面元素 Canvas 參考手冊的更多相关文章
- 6. GC 调优(工具篇) - GC參考手冊
进行GC性能调优时, 须要明白了解, 当前的GC行为对系统和用户有多大的影响. 有多种监控GC的工具和方法, 本章将逐一介绍经常使用的工具. 您应该已经阅读了前面的章节: 垃圾收集简单介绍 - GC參 ...
- ANTLR4权威參考手冊(一)
写在前面的话: 此文档是对伟大的Terence Parr的著作<the definitive antlr4 reference>的翻译本.致敬!欢迎转载,请注明原地址,请尊重劳动成果.翻译 ...
- Hadoop 2.6.0分布式部署參考手冊
Hadoop 2.6.0分布式部署參考手冊 关于本參考手冊的word文档.能够到例如以下地址下载:http://download.csdn.net/detail/u012875880/8291493 ...
- 刚開始学习的人非常有用之chm结尾的參考手冊打开后无法正常显示
从网上下载了struts2的參考手冊.chm(本文适用全部已.chm结尾的文件)不能正常打开使用. 如图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/ ...
- MySQL中文參考手冊
非常好的中文手冊: 链接:http://www.sdau.edu.cn/support/mysq_doc/manual_toc.html
- bash參考手冊之六(Bash特性)
6 Bash 特性 这部分描写叙述Bash独有的特性. * 调用Bash : Bash能够接受的命令行选项. * Bash启动文件 : Bash何时及怎样运行脚本. * 交互Shell : 什么 ...
- bash參考手冊之五(shell变量)续三
LINENO 当前在运行的脚本或者shell函数的行号. LINES 命令select用来确定打印选择列表的列宽.收到SIGWINCH后,自己主动设置. MACHTYPE 是一个字符串,描写叙述了正在 ...
- (十)unity4.6学习Ugui中文文档-------參考-UGUI Canvas Components
大家好,我是孙广东. 转载请注明出处:http://write.blog.csdn.net/postedit/38922399 更全的内容请看我的游戏蛮牛地址:http://www.unit ...
- 早来的圣诞礼物!--android 逆向菜鸟速參手冊完蛋版
我的说明: 让老皮特整理了这么长时间这个手冊,心里挺过意不去的,回头我去深圳带着他女儿去游乐场玩玩得了,辛苦了.peter! 太多的话语,也描写叙述不出这样的感觉了,得找个时间.不醉不归... 注:下 ...
随机推荐
- vue生命周期的基础部分
Vue实例从创建到销毁的过程,就是生命周期. Vue的生命周期包括:开始创建.初始化数据.编译模板.挂载Dom.渲染→更新→渲染.卸载等一系列过程. 在Vue的整个生命周期中,提供了一系列的事件,可以 ...
- tp框架引入第三方sdk的经验总结
tp框架开发常用到第三方的接口,这时候需要引入第三方的sdk.例如:微信扫码支付sdk,阿里大于的淘宝sdk等等 首先到官网上下载对应php的sdk文件,通常会有至少一个实例代码. 1 新建一个控制器 ...
- Spring IoC简介及使用
Spring根本任务 Spring的根本任务就是简化Java开发. 目前许多框架如果要使用他们,就必须要继承或实现这些框架的各种类.这使得框架与我们的程序耦合度过高.由于在我们的程序中加入了过多的框架 ...
- java源码之Comparable和Comparator
1,Comparable 简介 Comparable 是排序接口. 若一个类实现了Comparable接口,就意味着“该类支持排序”. 即然实现Comparable接口的类支持排序,假设现在存在“实 ...
- windows部署iBase4J
所需环境:jdk 1.8.eclipse(myeclipse不可以).nginx.activeMQ .zookeeper.redis 第一步 下载jdk1.8 按步骤安装至指定位置即可 第二步 安装e ...
- 关于amd64和ia64的理解
关于amd64和ia64的理解 学习了:http://blog.csdn.net/zubin006/article/details/5060383 IA64指的是Intel安腾系列CPU,不是X86架 ...
- 国家人工智能(AI)的美好前景
在今年两会期间.李彦宏(Robin Lee,1968-)关于人工智能(AI)"国家优先"的提案,即所谓的"中国大脑"计划.依据何在?为什么? 近几年,世界互联网 ...
- python实战之编码问题:中文!永远的痛
编码的思维图谱: 也就是说文件没有编码之说,事实上都是按二进制格式保存在硬盘中的.不过在写入读取时须使用相应的编码进行处理,以便操作系统配合相关软件/字体,绘制到屏幕中给人看.所以关键问题是得知道原先 ...
- 多项福利回馈会员,且看Hao123怎样玩转“霸权主义”
谈到"霸权主义",我们非常easy将其与国际政治联系在一起.只是.霸权主义可不全然用来形容政治,在7月14日,Hao123上线了一个会员福利活动,命名为"Hao1 ...
- MAVEN创建并打包web项目
maven项目是由一个maven project和多个maven module组成的,以下简介一下maven webapp的创建和打包,前提是你已经安装配置好maven了. 打开eclipse.依照例 ...