{"id":258,"date":"2014-11-22T22:13:49","date_gmt":"2014-11-22T14:13:49","guid":{"rendered":"http:\/\/www.hightopo.com\/blog\/?p=258"},"modified":"2014-11-22T22:16:45","modified_gmt":"2014-11-22T14:16:45","slug":"ht-for-web%e5%9f%ba%e4%ba%8ehtml5%e7%9a%84%e5%9b%be%e5%83%8f%e6%93%8d%e4%bd%9c%ef%bc%88%e4%ba%8c%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.hightopo.com\/blog\/258.html","title":{"rendered":"HT for Web\u57fa\u4e8eHTML5\u7684\u56fe\u50cf\u64cd\u4f5c\uff08\u4e8c\uff09"},"content":{"rendered":"<p><a href=\"http:\/\/www.hightopo.com\/blog\/251.html\">\u4e0a\u7bc7<\/a>\u4ecb\u7ecd\u4e86<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u91c7\u7528HTML5 Canvas\u7684getImageData\u548csetImageData\u51fd\u6570\uff0c\u901a\u8fc7\u989c\u8272\u4e58\u79ef\u5b9e\u73b0\u7684\u67d3\u8272\u6548\u679c\uff0c\u672c\u6587\u5c06\u518d\u6b21\u4ecb\u7ecd\u53e6\u4e00\u79cd\u66f4\u4e3a\u9ad8\u6548\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u5f53\u7136\u8981\u5b9e\u73b0\u7684\u529f\u80fd\u6548\u679c\u662f\u5b8c\u5168\u4e00\u6837\u7684\u3002\u8fd9\u6b21\u6211\u4eec\u4f9d\u7136\u57fa\u4e8eHTML5\u6280\u672f\uff0c\u4f46\u91c7\u7528Canvas\u7684globalCompositeOperation\u5c5e\u6027\u8fdb\u884c\u5404\u79cdblending\u6548\u679c\uff1a<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-259\" alt=\"Screen Shot 2014-11-22 at 9.42.52 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM.png\" width=\"584\" height=\"432\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM.png 584w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM-300x221.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM-200x147.png 200w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>\u5404\u79cdglobalCompositeOperation\u6548\u679c\u53ef\u53c2\u8003<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Canvas_API\/Tutorial\/Compositing\">https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Canvas_API\/Tutorial\/Compositing<\/a>\u00a0\u7684\u8bf4\u660e\uff0c\u6211\u4eec\u91c7\u7528\u201cmultiply\u201d\u548c\u201cdestination-atop\u201d\u8fd9\u4e24\u79cdblending\u6548\u679c\uff0c\u901a\u8fc7\u4ee5\u4e0b\u4e09\u4e2a\u6b65\u9aa4\u5b9e\u73b0:<\/p>\n<p>1\u3001\u5148\u4ee5\u67d3\u8272\u989c\u8272\u586b\u5145\u56fe\u7247\u5927\u5c0f\u7684\u77e9\u5f62\u533a\u57df<\/p>\n<p>2\u3001\u91c7\u7528\u201cmultiply\u201d\u8fdb\u884cdrawImage\u7684\u7ed8\u5236\uff0c\u8fbe\u5230\u4ee5\u4e0b\u6548\u679c<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-260\" alt=\"Screen Shot 2014-11-22 at 9.50.47 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM.png\" width=\"506\" height=\"508\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM.png 506w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM-150x150.png 150w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM-298x300.png 298w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM-200x200.png 200w\" sizes=\"(max-width: 506px) 100vw, 506px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>3\u3001\u6700\u540e\u4e00\u6b65\u91c7\u7528\u201cdestination-atop\u201d\u7684globalCompositeOperation\u65b9\u5f0f\uff0c\u518d\u6b21drawImage\uff0c\u8fd9\u6b21\u7ed8\u5236\u6548\u679c\u5c06\u4f1a\u62a0\u51fa\u56fe\u7247\u50cf\u7d20\u533a\u57df\uff0c\u5254\u9664\u975e\u56fe\u7247\u90e8\u5206\uff0c\u6700\u7ec8\u8fbe\u5230\u6211\u4eec\u6240\u8981\u7684\u67d3\u8272\u6548\u679c\u56fe\u7247\uff1a<\/p>\n<p><a style=\"line-height: 1.5em;\" href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-261\" alt=\"Screen Shot 2014-11-22 at 9.54.36 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM.png\" width=\"892\" height=\"270\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM.png 892w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM-300x90.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM-200x60.png 200w\" sizes=\"(max-width: 892px) 100vw, 892px\" \/><\/a><\/p>\n<p>\u6240\u6709\u4ee3\u7801\u5982\u4e0b<\/p>\n<pre class=\"brush:javascript\">\tfunction createColorImage2(image, color) {\r\n\t\tvar width = image.width;\r\n\t\tvar height = image.height;                \r\n\t\tvar canvas = document.createElement('canvas');\r\n\t\tvar context = canvas.getContext( \"2d\" );\r\n\t\tcanvas.width = width;\r\n\t\tcanvas.height = height;\r\n\t\tcontext.fillStyle = color;    \r\n\t\tcontext.fillRect(0, 0, width, height);    \r\n\t\tcontext.globalCompositeOperation = \"multiply\";\r\n\t\tcontext.drawImage(image, 0, 0, width, height);\r\n\t\tcontext.globalCompositeOperation = \"destination-atop\";\r\n\t\tcontext.drawImage(image, 0, 0, width, height);\r\n\t\treturn canvas;\r\n\t};<\/pre>\n<p>\u81f3\u6b64\u6211\u4eec\u6709\u4e24\u79cd\u622a\u7136\u4e0d\u540c\u7684\u7ed8\u5236\u65b9\u5f0f\uff0c\u4e24\u8005\u7684\u4ee3\u7801\u91cf\u5dee\u4e0d\u591a\uff0c\u8be5\u9009\u62e9\u8c01\u5462\uff1f\u8ba9\u6211\u4eec\u6d4b\u8bd5\u4e0b\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f\u7684\u6027\u80fd:<\/p>\n<pre class=\"brush:javascript\">\ttime = new Date().getTime();\r\n\tfor(var i=0; i&lt;100; i++){\r\n\t\tcreateColorImage1(image, 'red');\r\n\t}\r\n\tconsole.log(new Date().getTime() - time);\r\n\r\n\ttime = new Date().getTime();\r\n\tfor(var i=0; i&lt;100; i++){\r\n\t\tcreateColorImage2(image, 'red');\r\n\t}\r\n\tconsole.log(new Date().getTime() - time);<\/pre>\n<p>\u6211\u5728mac air\u7684chrome\u6d4f\u89c8\u5668\u4e0b\u6d4b\u8bd5\u4e86\u4ee5\u4e0a\u4ee3\u7801\uff0ccreateColorImage1\u9700\u89811630\u6beb\u79d2\uff0ccreateColorImage2\u9700\u898129\u6beb\u79d2\uff0c\u4e24\u8005\u76f8\u5dee56\u500d\uff0c\u4e5f\u5c31\u662f\u8bf4\u91c7\u7528globalCompositeOperation\u867d\u7136\u8fdb\u884c\u4e86\u4e24\u6b21drawImage\uff0c\u4f46\u6027\u80fd\u4f9d\u7136\u8fdc\u9ad8\u4e8e\u901a\u8fc7getImageData\u9010\u4e2a\u8bbe\u7f6e\u50cf\u7d20\u503c\u7684\u65b9\u5f0f\u3002<\/p>\n<p>\u9020\u6210\u8fd9\u79cd\u5de8\u5927\u5dee\u8ddd\u7684\u6839\u672c\u539f\u56e0\u5728\u4e8ecreateColorImage1\u7684\u65b9\u5f0f\u5b8c\u5168\u57fa\u4e8eCPU\u8fd0\u7b97\uff0cjs\u672c\u5c31\u5355\u7ebf\u7a0b\uff0c\u4e14\u5bc6\u96c6\u6570\u503c\u8fd0\u7b97\u4e5f\u4e0d\u662fjs\u7684\u5f3a\u9879\uff0c\u800c\u91c7\u7528globalCompositeOperation\u7684\u6e32\u67d3\u65b9\u5f0f\uff0c\u6d4f\u89c8\u5668\u5e95\u5c42\u5b8c\u5168\u53ef\u4ee5\u91c7\u7528GPU\u7b49\u786c\u4ef6\u52a0\u901f\u7684\u65b9\u5f0f\u8fbe\u5230\u66f4\u52a0\u7684\u6027\u80fd\uff0c\u56e0\u6b64\u4e24\u949f\u65b9\u5f0f\u6027\u80fd\u5dee\u5f02\u51e0\u5341\u500d\u4e5f\u4e0d\u8db3\u4e3a\u5947\u4e86\uff0c\u6709\u5174\u8da3\u53ef\u53c2\u8003\u5fae\u8f6f\u7684\u51e0\u7bc7\u5173\u4e8e\u6d4f\u89c8\u5668Canvas\u786c\u4ef6\u52a0\u901f\u76f8\u5173\u7684\u6587\u7ae0\uff1a<\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/b\/ie\/archive\/2011\/04\/26\/understanding-differences-in-hardware-acceleration-through-paintball.aspx\">http:\/\/blogs.msdn.com\/b\/ie\/archive\/2011\/04\/26\/understanding-differences-in-hardware-acceleration-through-paintball.aspx<\/a><\/p>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/hh562071.aspx\">http:\/\/msdn.microsoft.com\/en-us\/hh562071.aspx<\/a><\/p>\n<p>\u4ee5\u4e0a\u4e24\u79cd\u65b9\u5f0f\u90fd\u662f\u57fa\u4e8eHTML5\u7684Canvas\u76842D\u65b9\u5f0f\uff0c\u5176\u5b9e\u66f4\u76f4\u63a5\u501f\u52a9GPU\u7684\u5e94\u8be5\u662fCanvas\u7684WebGL\u6280\u672f\uff0c\u4e0b\u7bc7\u6211\u4eec\u5c06\u4ecb\u7ecd\u66f4\u597d\u73a9\u7684\u57fa\u4e8eWebGL\u7684Shading Language\u7684\u50cf\u7d20\u64cd\u4f5c\u65b9\u5f0f\uff0c\u5f53\u7136\u4f7f\u7528<a href=\"http:\/\/www.hightopo.com\/\">Hightopo<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4e0d\u9700\u8981\u5173\u5fc3\u8fd9\u4e9b\u5e95\u5c42\u6280\u672f\u7ec6\u8282\uff0c<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u4f1a\u81ea\u52a8\u9009\u62e9\u6700\u5408\u9002\u7684\u67d3\u8272\u673a\u5236\uff0c\u56e0\u4e3a\u6709\u4e9b\u7ec8\u7aef\u6d4f\u89c8\u5668\u4e0d\u652f\u6301globalCompositeOperation\u7684\u529f\u80fd\uff0c\u6709\u4e9b\u4e0d\u652f\u6301WebGL\u7684\u786c\u4ef6\u52a0\u901f\uff0c\u56e0\u6b64\u81ea\u52a8\u9009\u62e9\u6700\u5408\u9002\u7684\u6e32\u67d3\u673a\u5236\u4e5f\u662f\u9700\u8981\u5e95\u5c42\u6846\u67b6\u8db3\u591f\u667a\u80fd\u5316\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"http:\/\/www.hightopo.com\/blog\/251.html\">\u4e0a\u7bc7<\/a>\u4ecb\u7ecd\u4e86<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u91c7\u7528HTML5 Canvas\u7684getImageData\u548csetImageData\u51fd\u6570\uff0c\u901a\u8fc7\u989c\u8272\u4e58\u79ef\u5b9e\u73b0\u7684\u67d3\u8272\u6548\u679c\uff0c\u672c\u6587\u5c06\u518d\u6b21\u4ecb\u7ecd\u53e6\u4e00\u79cd\u66f4\u4e3a\u9ad8\u6548\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u5f53\u7136\u8981\u5b9e\u73b0\u7684\u529f\u80fd\u6548\u679c\u662f\u5b8c\u5168\u4e00\u6837\u7684\u3002\u8fd9\u6b21\u6211\u4eec\u4f9d\u7136\u57fa\u4e8eHTML5\u6280\u672f\uff0c\u4f46\u91c7\u7528Canvas\u7684globalCompositeOperation\u5c5e\u6027\u8fdb\u884c\u5404\u79cdblending\u6548\u679c\uff1a<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-259\" alt=\"Screen Shot 2014-11-22 at 9.42.52 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM.png\" width=\"584\" height=\"432\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM.png 584w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM-300x221.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.42.52-PM-200x147.png 200w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>\u5404\u79cdglobalCompositeOperation\u6548\u679c\u53ef\u53c2\u8003<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Canvas_API\/Tutorial\/Compositing\">https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Canvas_API\/Tutorial\/Compositing<\/a>\u00a0\u7684\u8bf4\u660e\uff0c\u6211\u4eec\u91c7\u7528\u201cmultiply\u201d\u548c\u201cdestination-atop\u201d\u8fd9\u4e24\u79cdblending\u6548\u679c\uff0c\u901a\u8fc7\u4ee5\u4e0b\u4e09\u4e2a\u6b65\u9aa4\u5b9e\u73b0:<\/p>\n<p>1\u3001\u5148\u4ee5\u67d3\u8272\u989c\u8272\u586b\u5145\u56fe\u7247\u5927\u5c0f\u7684\u77e9\u5f62\u533a\u57df<\/p>\n<p>2\u3001\u91c7\u7528\u201cmultiply\u201d\u8fdb\u884cdrawImage\u7684\u7ed8\u5236\uff0c\u8fbe\u5230\u4ee5\u4e0b\u6548\u679c<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-260\" alt=\"Screen Shot 2014-11-22 at 9.50.47 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM.png\" width=\"506\" height=\"508\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM.png 506w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM-150x150.png 150w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM-298x300.png 298w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.50.47-PM-200x200.png 200w\" sizes=\"(max-width: 506px) 100vw, 506px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>3\u3001\u6700\u540e\u4e00\u6b65\u91c7\u7528\u201cdestination-atop\u201d\u7684globalCompositeOperation\u65b9\u5f0f\uff0c\u518d\u6b21drawImage\uff0c\u8fd9\u6b21\u7ed8\u5236\u6548\u679c\u5c06\u4f1a\u62a0\u51fa\u56fe\u7247\u50cf\u7d20\u533a\u57df\uff0c\u5254\u9664\u975e\u56fe\u7247\u90e8\u5206\uff0c\u6700\u7ec8\u8fbe\u5230\u6211\u4eec\u6240\u8981\u7684\u67d3\u8272\u6548\u679c\u56fe\u7247\uff1a<\/p>\n<p><a style=\"line-height: 1.5em;\" href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-261\" alt=\"Screen Shot 2014-11-22 at 9.54.36 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM.png\" width=\"892\" height=\"270\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM.png 892w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM-300x90.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/11\/Screen-Shot-2014-11-22-at-9.54.36-PM-200x60.png 200w\" sizes=\"(max-width: 892px) 100vw, 892px\" \/><\/a><\/p>\n<p>\u6240\u6709\u4ee3\u7801\u5982\u4e0b<\/p>\n<pre class=\"brush:javascript\">\tfunction createColorImage2(image, color) {\r\n\t\tvar width = image.width;\r\n\t\tvar height = image.height;                \r\n\t\tvar canvas = document.createElement('canvas');\r\n\t\tvar context = canvas.getContext( \"2d\" );\r\n\t\tcanvas.width = width;\r\n\t\tcanvas.height = height;\r\n\t\tcontext.fillStyle = color;    \r\n\t\tcontext.fillRect(0, 0, width, height);    \r\n\t\tcontext.globalCompositeOperation = \"multiply\";\r\n\t\tcontext.drawImage(image, 0, 0, width, height);\r\n\t\tcontext.globalCompositeOperation = \"destination-atop\";\r\n\t\tcontext.drawImage(image, 0, 0, width, height);\r\n\t\treturn canvas;\r\n\t};<\/pre>\n<p>\u81f3\u6b64\u6211\u4eec\u6709\u4e24\u79cd\u622a\u7136\u4e0d\u540c\u7684\u7ed8\u5236\u65b9\u5f0f\uff0c\u4e24\u8005\u7684\u4ee3\u7801\u91cf\u5dee\u4e0d\u591a\uff0c\u8be5\u9009\u62e9\u8c01\u5462\uff1f\u8ba9\u6211\u4eec\u6d4b\u8bd5\u4e0b\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f\u7684\u6027\u80fd:<\/p>\n<pre class=\"brush:javascript\">\ttime = new Date().getTime();\r\n\tfor(var i=0; i&lt;100; i++){\r\n\t\tcreateColorImage1(image, 'red');\r\n\t}\r\n\tconsole.log(new Date().getTime() - time);\r\n\r\n\ttime = new Date().getTime();\r\n\tfor(var i=0; i&lt;100; i++){\r\n\t\tcreateColorImage2(image, 'red');\r\n\t}\r\n\tconsole.log(new Date().getTime() - time);<\/pre>\n<p>\u6211\u5728mac air\u7684chrome\u6d4f\u89c8\u5668\u4e0b\u6d4b\u8bd5\u4e86\u4ee5\u4e0a\u4ee3\u7801\uff0ccreateColorImage1\u9700\u89811630\u6beb\u79d2\uff0ccreateColorImage2\u9700\u898129\u6beb\u79d2\uff0c\u4e24\u8005\u76f8\u5dee56\u500d\uff0c\u4e5f\u5c31\u662f\u8bf4\u91c7\u7528globalCompositeOperation\u867d\u7136\u8fdb\u884c\u4e86\u4e24\u6b21drawImage\uff0c\u4f46\u6027\u80fd\u4f9d\u7136\u8fdc\u9ad8\u4e8e\u901a\u8fc7getImageData\u9010\u4e2a\u8bbe\u7f6e\u50cf\u7d20\u503c\u7684\u65b9\u5f0f\u3002<\/p>\n<p>\u9020\u6210\u8fd9\u79cd\u5de8\u5927\u5dee\u8ddd\u7684\u6839\u672c\u539f\u56e0\u5728\u4e8ecreateColorImage1\u7684\u65b9\u5f0f\u5b8c\u5168\u57fa\u4e8eCPU\u8fd0\u7b97\uff0cjs\u672c\u5c31\u5355\u7ebf\u7a0b\uff0c\u4e14\u5bc6\u96c6\u6570\u503c\u8fd0\u7b97\u4e5f\u4e0d\u662fjs\u7684\u5f3a\u9879\uff0c\u800c\u91c7\u7528globalCompositeOperation\u7684\u6e32\u67d3\u65b9\u5f0f\uff0c\u6d4f\u89c8\u5668\u5e95\u5c42\u5b8c\u5168\u53ef\u4ee5\u91c7\u7528GPU\u7b49\u786c\u4ef6\u52a0\u901f\u7684\u65b9\u5f0f\u8fbe\u5230\u66f4\u52a0\u7684\u6027\u80fd\uff0c\u56e0\u6b64\u4e24\u949f\u65b9\u5f0f\u6027\u80fd\u5dee\u5f02\u51e0\u5341\u500d\u4e5f\u4e0d\u8db3\u4e3a\u5947\u4e86\uff0c\u6709\u5174\u8da3\u53ef\u53c2\u8003\u5fae\u8f6f\u7684\u51e0\u7bc7\u5173\u4e8e\u6d4f\u89c8\u5668Canvas\u786c\u4ef6\u52a0\u901f\u76f8\u5173\u7684\u6587\u7ae0\uff1a<\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/b\/ie\/archive\/2011\/04\/26\/understanding-differences-in-hardware-acceleration-through-paintball.aspx\">http:\/\/blogs.msdn.com\/b\/ie\/archive\/2011\/04\/26\/understanding-differences-in-hardware-acceleration-through-paintball.aspx<\/a><\/p>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/hh562071.aspx\">http:\/\/msdn.microsoft.com\/en-us\/hh562071.aspx<\/a><\/p>\n<p>\u4ee5\u4e0a\u4e24\u79cd\u65b9\u5f0f\u90fd\u662f\u57fa\u4e8eHTML5\u7684Canvas\u76842D\u65b9\u5f0f\uff0c\u5176\u5b9e\u66f4\u76f4\u63a5\u501f\u52a9GPU\u7684\u5e94\u8be5\u662fCanvas\u7684WebGL\u6280\u672f\uff0c\u4e0b\u7bc7\u6211\u4eec\u5c06\u4ecb\u7ecd\u66f4\u597d\u73a9\u7684\u57fa\u4e8eWebGL\u7684Shading Language\u7684\u50cf\u7d20\u64cd\u4f5c\u65b9\u5f0f\uff0c\u5f53\u7136\u4f7f\u7528<a href=\"http:\/\/www.hightopo.com\/\">Hightopo<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4e0d\u9700\u8981\u5173\u5fc3\u8fd9\u4e9b\u5e95\u5c42\u6280\u672f\u7ec6\u8282\uff0c<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u4f1a\u81ea\u52a8\u9009\u62e9\u6700\u5408\u9002\u7684\u67d3\u8272\u673a\u5236\uff0c\u56e0\u4e3a\u6709\u4e9b\u7ec8\u7aef\u6d4f\u89c8\u5668\u4e0d\u652f\u6301globalCompositeOperation\u7684\u529f\u80fd\uff0c\u6709\u4e9b\u4e0d\u652f\u6301WebGL\u7684\u786c\u4ef6\u52a0\u901f\uff0c\u56e0\u6b64\u81ea\u52a8\u9009\u62e9\u6700\u5408\u9002\u7684\u6e32\u67d3\u673a\u5236\u4e5f\u662f\u9700\u8981\u5e95\u5c42\u6846\u67b6\u8db3\u591f\u667a\u80fd\u5316\u7684\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/258"}],"collection":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":2,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":263,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/258\/revisions\/263"}],"wp:attachment":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}