files/en-us/web/api/htmlcanvaselement/mozopaque/index.md
{{APIRef("Canvas API")}}{{deprecated_header}}{{non-standard_header}}
The non-standard HTMLCanvasElement.mozOpaque property is
a boolean value reflecting the moz-opaque HTML
attribute of the {{HTMLElement("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.
[!NOTE] This has been standardized as setting the
alphaoption tofalsewhen creating a drawing context with {{domxref("HTMLCanvasElement.getContext()")}}. Use ofmozOpaqueshould be avoided. Firefox will stop supporting it in the future.
A boolean value.
Given this {{HTMLElement("canvas")}} element:
<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.
const canvas = document.getElementById("canvas");
console.log(canvas.mozOpaque); // true
// deactivate it
canvas.mozOpaque = false;
Not part of any standard.
{{Compat}}
HTMLCanvasElement.mozOpaque propertymoz-opaque: HTML attribute of the {{HTMLElement("canvas")}} element