合成属性

globalAlpha                                设置或返回绘图的当前 alpha 或透明值
globalCompositeOperation                设置或返回新图像如何绘制到已有的图像上

    <script type="text/javascript">
var arr=new Array();
arr.push("source-atop");
arr.push("source-in");
arr.push("source-out");
arr.push("source-over");
arr.push("destination-atop");
arr.push("destination-in");
arr.push("destination-out");
arr.push("destination-over");
arr.push("lighter");
arr.push("copy");
arr.push("xor");
for (var i=0;i<arr.length;i++){
document.write("<div id='p_"+ i +"'style='float:left;border:1px solid #000'>"+arr[i]+":<br>");
var c=document.createElement("canvas");
c.width=120;
c.height=100;
document.getElementById("p_"+i).appendChild(c);
var ctx=c.getContext("2d");
ctx.fillStyle="blue";
ctx.fillRect(10,10,50,50);
ctx.globalCompositeOperation=arr[i];//设置或返回新图像如何绘制到已有的图像上
ctx.beginPath();
ctx.fillStyle="red";
ctx.globalAlpha=0.8; //设置或返回绘图的当前 alpha 或透明值
ctx.arc(50,50,30,0,2*Math.PI);
ctx.fill();
document.write("</div>");
}
</script>

最新文章

  1. MS SQL巡检系列&mdash;&mdash;检查重复索引
  2. UDP Server
  3. python之初级学习
  4. SQL查询数据库中所有指定类型的字段名称和所在的表名
  5. WPF 竖排文字
  6. Android 4.4 KitKat, the browser and the Chrome WebView
  7. Selenium2Library系列 keywords 之 _SelectElementKeywords 之 list_should_have_no_selections(self, locator)
  8. javaweb项目的优化 - 几番思念
  9. iOS之ViewController的多层presentViewController的dismiss问题
  10. EOS智能合约存储实例讲解
  11. Python_程序实现发红包
  12. React+ES6+Webpack深入浅出
  13. 【LeetCode每天一题】4Sum(4数之和)
  14. SQL server 数据库的数据完整性
  15. C# 获取汉字拼音首字母/全拼
  16. 删除node_modules
  17. AngularJs(SPA)单页面SEO以及百度统计应用(上)
  18. gym 100531 三维几何+搜索
  19. 迭代最近点算法 Iterative Closest Points
  20. linux 常用操作以及概念

热门文章

  1. IIS的安装与配置详细图解教程。
  2. (转载)偏序集的Dilworth定理学习
  3. oracle连接总结(内连接、外连接、自然连接,交叉连接,自连接)
  4. 如何编写一个JSON解析器
  5. iOS键盘覆盖输入框的处理.doc
  6. Android 物理按键
  7. struts2在web.xml中配置详情
  8. android 使用String.format(&quot;%.2f&quot;,67.876)自已定义语言(俄语、西班牙语)会把小数点变为逗号
  9. HttpWebRequest get/post方法实现
  10. xheditor编辑器上传截图图片抓取远程图片代码