非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
The non-standard
HTMLCanvasElement.mozOpaque
特性为
布尔
反射
moz-opaque
HTML attribute of the
<canvas>
element. It lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized.
This has been standardized as setting the
alpha
选项到
false
when creating a drawing context with
HTMLCanvasElement.getContext()
. Use of
mozOpaque
should be avoided. Firefox will stop supporting it in the future.
var opaque = canvas.mozOpaque; canvas.mozOpaque = true;
Given this
<canvas>
元素:
<canvas id="canvas" width="300" height="300" moz-opaque></canvas>
You can get or set the
mozOpaque
property. For example, you could conditionally set it to
true
if
mimeType == 'image/jpeg'
, or similar, to gain performance in your application when translucency is not needed.
var canvas = document.getElementById('canvas');
console.log(canvas.mozOpaque); // true
// deactivate it
canvas.mozOpaque = false;
Not part of any standard.
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
mozOpaque
非标
|
Chrome No | Edge No | Firefox 3 | IE No | Opera No | Safari No | WebView Android No | Chrome Android No | Firefox Android 4 | Opera Android No | Safari iOS No | Samsung Internet Android No |
完整支持
不支持
非标。预期跨浏览器支持较差。
HTMLCanvasElement
.
moz-opaque
HTML attribute of the
<canvas>
元素。