aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmlcanvaselement/mozopaque
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/htmlcanvaselement/mozopaque
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/htmlcanvaselement/mozopaque')
-rw-r--r--files/zh-cn/web/api/htmlcanvaselement/mozopaque/index.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlcanvaselement/mozopaque/index.html b/files/zh-cn/web/api/htmlcanvaselement/mozopaque/index.html
new file mode 100644
index 0000000000..b82b5718db
--- /dev/null
+++ b/files/zh-cn/web/api/htmlcanvaselement/mozopaque/index.html
@@ -0,0 +1,53 @@
+---
+title: HTMLCanvasElement.mozOpaque
+slug: Web/API/HTMLCanvasElement/mozOpaque
+tags:
+ - API
+ - Canvas
+ - HTMLCanvasElement
+translation_of: Web/API/HTMLCanvasElement/mozOpaque
+---
+<div>{{APIRef("Canvas API")}}{{non-standard_header}}</div>
+
+<p>非标准的 <strong><code>HTMLCanvasElement.mozOpaque</code></strong> 是一种 {{jsxref("Boolean")}} 的数据反映了{{HTMLElement("canvas")}}元素的{htmlattrxref("moz-opaque", "canvas")} HTML属性。它能够让画布(canvas)将半透明作为一个参考因素。如果画布知道没有半透明因素,作画的性能可以优化。</p>
+
+<p class="note">当使用{{domxref("HTMLCanvasElement.getContext()")}}创建绘图上下文时,该api将被标准化为将alpha选项设置为false。应该避免使用mozOpaque。Firefox将在未来停止支持它。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox notranslate">var <em>opaque</em> = <em>canvas</em>.mozOpaque;
+<em>canvas</em>.mozOpaque = true;
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<p>有如下{{HTMLElement("canvas")}} 元素:</p>
+
+<pre class="brush: html notranslate">&lt;canvas id="canvas" width="300" height="300" moz-opaque&gt;&lt;/canvas&gt;
+</pre>
+
+<p>你可以获取或设置 <code>mozOpaque</code> 属性. 例如,当mimeType == 'image/jpeg'或类似值时,可以将其属性值设置为true,以在不需要半透明度的情况下提高应用程序的性能。</p>
+
+<pre class="brush: js notranslate">var canvas = document.getElementById('canvas');
+console.log(canvas.mozOpaque); // true
+// 停用该方法
+canvas.mozOpaque = false;
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<p>不属于任何标准。</p>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div class="hidden">此页面上的兼容性表是由结构化数据生成的。如果您想贡献数据,请查看https://github.com/mdn/browser-compat-data并向我们发送pull请求。</div>
+
+<p>{{Compat("api.HTMLCanvasElement.mozOpaque")}}</p>
+
+<h2 id="See_Also" name="See_Also">参考</h2>
+
+<ul>
+ <li>定义它的接口, {{domxref("HTMLCanvasElement")}}.</li>
+ <li>{{HTMLElement("canvas")}} 元素的{{htmlattrxref("moz-opaque", "canvas")}}HTML属性</li>
+ <li><a href="https://hacks.mozilla.org/2013/05/optimizing-your-javascript-game-for-firefox-os/">为Firefox OS优化你的JavaScript游戏</a></li>
+</ul>