1 module libwasm.bindings.OffscreenCanvas;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.Blob;
7 import libwasm.bindings.EventTarget;
8 import libwasm.bindings.ImageBitmap;
9 
10 @safe:
11 nothrow:
12 
13 struct OffscreenCanvas {
14   nothrow:
15   libwasm.bindings.EventTarget.EventTarget _parent;
16   alias _parent this;
17   this(Handle h) {
18     _parent = .EventTarget(h);
19   }
20   void width()(uint width) {
21     Object_Call_uint__void(this._parent, "width", width);
22   }
23   uint width()() {
24     return Object_Getter__uint(this._parent, "width");
25   }
26   void height()(uint height) {
27     Object_Call_uint__void(this._parent, "height", height);
28   }
29   uint height()() {
30     return Object_Getter__uint(this._parent, "height");
31   }
32   auto getContext(T1)(string contextId, scope auto ref T1 contextOptions /* = null */) {
33     // Any
34     Handle _handle_contextOptions = getOrCreateHandle(contextOptions);
35     auto result = recastOpt!(nsISupports)(Serialize_Object_VarArgCall!(Optional!Handle)(this._parent, "getContext", "string;Handle", tuple(contextId, _handle_contextOptions)));
36     dropHandle!(T1)(_handle_contextOptions);
37     return result;
38   }
39   auto getContext()(string contextId) {
40     return recastOpt!(nsISupports)(Object_Call_string__OptionalHandle(this._parent, "getContext", contextId));
41   }
42   auto transferToImageBitmap()() {
43     return ImageBitmap(Object_Getter__Handle(this._parent, "transferToImageBitmap"));
44   }
45   auto toBlob(T1)(string type /* = "" */, scope auto ref T1 encoderOptions) {
46     // Any
47     Handle _handle_encoderOptions = getOrCreateHandle(encoderOptions);
48     auto result = JsPromise!(Blob)(Serialize_Object_VarArgCall!Handle(this._parent, "toBlob", "string;Handle", tuple(type, _handle_encoderOptions)));
49     dropHandle!(T1)(_handle_encoderOptions);
50     return result;
51   }
52   auto toBlob()(string type /* = "" */) {
53     return JsPromise!(Blob)(Object_Call_string__Handle(this._parent, "toBlob", type));
54   }
55   auto toBlob()() {
56     return JsPromise!(Blob)(Object_Getter__Handle(this._parent, "toBlob"));
57   }
58 }
59 
60