|
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
5 * |
|
6 * The origin of this IDL file is |
|
7 * http://www.whatwg.org/specs/web-apps/current-work/#the-canvas-element |
|
8 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and |
|
9 * Opera Software ASA. You are granted a license to use, reproduce |
|
10 * and create derivative works of this document. |
|
11 */ |
|
12 |
|
13 interface Blob; |
|
14 interface nsIInputStreamCallback; |
|
15 interface nsISupports; |
|
16 interface Variant; |
|
17 |
|
18 interface HTMLCanvasElement : HTMLElement { |
|
19 [Pure, SetterThrows] |
|
20 attribute unsigned long width; |
|
21 [Pure, SetterThrows] |
|
22 attribute unsigned long height; |
|
23 |
|
24 [Throws] |
|
25 nsISupports? getContext(DOMString contextId, optional any contextOptions = null); |
|
26 |
|
27 [Throws] |
|
28 DOMString toDataURL(optional DOMString type = "", |
|
29 optional any encoderOptions); |
|
30 [Throws] |
|
31 void toBlob(FileCallback _callback, |
|
32 optional DOMString type = "", |
|
33 optional any encoderOptions); |
|
34 }; |
|
35 |
|
36 // Mozilla specific bits |
|
37 partial interface HTMLCanvasElement { |
|
38 [Pure, SetterThrows] |
|
39 attribute boolean mozOpaque; |
|
40 [Throws] |
|
41 File mozGetAsFile(DOMString name, optional DOMString? type = null); |
|
42 [ChromeOnly, Throws] |
|
43 nsISupports? MozGetIPCContext(DOMString contextId); |
|
44 [ChromeOnly] |
|
45 void mozFetchAsStream(nsIInputStreamCallback callback, optional DOMString? type = null); |
|
46 attribute PrintCallback? mozPrintCallback; |
|
47 }; |
|
48 |
|
49 [ChromeOnly] |
|
50 interface MozCanvasPrintState |
|
51 { |
|
52 // A canvas rendering context. |
|
53 readonly attribute nsISupports context; |
|
54 |
|
55 // To be called when rendering to the context is done. |
|
56 void done(); |
|
57 }; |
|
58 |
|
59 callback PrintCallback = void(MozCanvasPrintState ctx); |
|
60 |
|
61 callback FileCallback = void(Blob file); |