@@ -5,17 +5,17 @@ import JavaScriptKit
5
5
6
6
public protocol Any_RenderingContext : ConvertibleToJSValue { }
7
7
extension CanvasRenderingContext2D : Any_RenderingContext { }
8
- //extension GPUCanvasContext: Any_RenderingContext {}
8
+ // extension GPUCanvasContext: Any_RenderingContext {}
9
9
extension ImageBitmapRenderingContext : Any_RenderingContext { }
10
- //extension WebGL2RenderingContext: Any_RenderingContext {}
11
- //extension WebGLRenderingContext: Any_RenderingContext {}
10
+ // extension WebGL2RenderingContext: Any_RenderingContext {}
11
+ // extension WebGLRenderingContext: Any_RenderingContext {}
12
12
13
13
public enum RenderingContext : JSValueCompatible , Any_RenderingContext {
14
14
case canvasRenderingContext2D( CanvasRenderingContext2D )
15
15
// case gpuCanvasContext(GPUCanvasContext)
16
16
case imageBitmapRenderingContext( ImageBitmapRenderingContext )
17
- // case webGL2RenderingContext(WebGL2RenderingContext)
18
- // case webGLRenderingContext(WebGLRenderingContext)
17
+ case webGL2RenderingContext( WebGL2RenderingContext )
18
+ case webGLRenderingContext( WebGLRenderingContext )
19
19
20
20
var canvasRenderingContext2D : CanvasRenderingContext2D ? {
21
21
switch self {
@@ -31,26 +31,26 @@ public enum RenderingContext: JSValueCompatible, Any_RenderingContext {
31
31
// }
32
32
// }
33
33
34
- var imageBitmapRenderingContext : ImageBitmapRenderingContext ? {
34
+ public var imageBitmapRenderingContext : ImageBitmapRenderingContext ? {
35
35
switch self {
36
36
case let . imageBitmapRenderingContext( imageBitmapRenderingContext) : return imageBitmapRenderingContext
37
37
default : return nil
38
38
}
39
39
}
40
40
41
- // var webGL2RenderingContext: WebGL2RenderingContext? {
42
- // switch self {
43
- // case let .webGL2RenderingContext(webGL2RenderingContext): return webGL2RenderingContext
44
- // default: return nil
45
- // }
46
- // }
47
- //
48
- // var webGLRenderingContext: WebGLRenderingContext? {
49
- // switch self {
50
- // case let .webGLRenderingContext(webGLRenderingContext): return webGLRenderingContext
51
- // default: return nil
52
- // }
53
- // }
41
+ public var webGL2RenderingContext : WebGL2RenderingContext ? {
42
+ switch self {
43
+ case let . webGL2RenderingContext( webGL2RenderingContext) : return webGL2RenderingContext
44
+ default : return nil
45
+ }
46
+ }
47
+
48
+ public var webGLRenderingContext : WebGLRenderingContext ? {
49
+ switch self {
50
+ case let . webGLRenderingContext( webGLRenderingContext) : return webGLRenderingContext
51
+ default : return nil
52
+ }
53
+ }
54
54
55
55
public static func construct( from value: JSValue ) -> Self ? {
56
56
if let canvasRenderingContext2D: CanvasRenderingContext2D = value. fromJSValue ( ) {
@@ -62,12 +62,12 @@ public enum RenderingContext: JSValueCompatible, Any_RenderingContext {
62
62
if let imageBitmapRenderingContext: ImageBitmapRenderingContext = value. fromJSValue ( ) {
63
63
return . imageBitmapRenderingContext( imageBitmapRenderingContext)
64
64
}
65
- // if let webGL2RenderingContext: WebGL2RenderingContext = value.fromJSValue() {
66
- // return .webGL2RenderingContext(webGL2RenderingContext)
67
- // }
68
- // if let webGLRenderingContext: WebGLRenderingContext = value.fromJSValue() {
69
- // return .webGLRenderingContext(webGLRenderingContext)
70
- // }
65
+ if let webGL2RenderingContext: WebGL2RenderingContext = value. fromJSValue ( ) {
66
+ return . webGL2RenderingContext( webGL2RenderingContext)
67
+ }
68
+ if let webGLRenderingContext: WebGLRenderingContext = value. fromJSValue ( ) {
69
+ return . webGLRenderingContext( webGLRenderingContext)
70
+ }
71
71
return nil
72
72
}
73
73
@@ -79,10 +79,10 @@ public enum RenderingContext: JSValueCompatible, Any_RenderingContext {
79
79
// return gpuCanvasContext.jsValue
80
80
case let . imageBitmapRenderingContext( imageBitmapRenderingContext) :
81
81
return imageBitmapRenderingContext. jsValue
82
- // case let .webGL2RenderingContext(webGL2RenderingContext):
83
- // return webGL2RenderingContext.jsValue
84
- // case let .webGLRenderingContext(webGLRenderingContext):
85
- // return webGLRenderingContext.jsValue
82
+ case let . webGL2RenderingContext( webGL2RenderingContext) :
83
+ return webGL2RenderingContext. jsValue
84
+ case let . webGLRenderingContext( webGLRenderingContext) :
85
+ return webGLRenderingContext. jsValue
86
86
}
87
87
}
88
88
}
0 commit comments