/
depth.go
119 lines (102 loc) · 2.96 KB
/
depth.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Code generated by webidl-bind. DO NOT EDIT.
// +build !js
package depth
import js "github.com/gowebapi/webapi/core/js"
import (
"github.com/gowebapi/webapi/javascript"
)
// using following types:
// javascript.Float32Array
// source idl files:
// mediacapture-depth.idl
// transform files:
// mediacapture-depth.go.md
// workaround for compiler error
func unused(value interface{}) {
// TODO remove this method
}
type Union struct {
Value js.Value
}
func (u *Union) JSValue() js.Value {
return u.Value
}
func UnionFromJS(value js.Value) *Union {
return &Union{Value: value}
}
// dictionary: DistortionCoefficients
type DistortionCoefficients struct {
K1 float64
K2 float64
P1 float64
P2 float64
K3 float64
}
// JSValue is allocating a new javascript object and copy
// all values
func (_this *DistortionCoefficients) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.K1
out.Set("k1", value0)
value1 := _this.K2
out.Set("k2", value1)
value2 := _this.P1
out.Set("p1", value2)
value3 := _this.P2
out.Set("p2", value3)
value4 := _this.K3
out.Set("k3", value4)
return out
}
// DistortionCoefficientsFromJS is allocating a new
// DistortionCoefficients object and copy all values in the value javascript object.
func DistortionCoefficientsFromJS(value js.Value) *DistortionCoefficients {
var out DistortionCoefficients
var (
value0 float64 // javascript: double {k1 K1 k1}
value1 float64 // javascript: double {k2 K2 k2}
value2 float64 // javascript: double {p1 P1 p1}
value3 float64 // javascript: double {p2 P2 p2}
value4 float64 // javascript: double {k3 K3 k3}
)
value0 = (value.Get("k1")).Float()
out.K1 = value0
value1 = (value.Get("k2")).Float()
out.K2 = value1
value2 = (value.Get("p1")).Float()
out.P1 = value2
value3 = (value.Get("p2")).Float()
out.P2 = value3
value4 = (value.Get("k3")).Float()
out.K3 = value4
return &out
}
// dictionary: Transformation
type Transformation struct {
TransformationMatrix *javascript.Float32Array
VideoDeviceId string
}
// JSValue is allocating a new javascript object and copy
// all values
func (_this *Transformation) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.TransformationMatrix.JSValue()
out.Set("transformationMatrix", value0)
value1 := _this.VideoDeviceId
out.Set("videoDeviceId", value1)
return out
}
// TransformationFromJS is allocating a new
// Transformation object and copy all values in the value javascript object.
func TransformationFromJS(value js.Value) *Transformation {
var out Transformation
var (
value0 *javascript.Float32Array // javascript: Float32Array {transformationMatrix TransformationMatrix transformationMatrix}
value1 string // javascript: DOMString {videoDeviceId VideoDeviceId videoDeviceId}
)
value0 = javascript.Float32ArrayFromJS(value.Get("transformationMatrix"))
out.TransformationMatrix = value0
value1 = (value.Get("videoDeviceId")).String()
out.VideoDeviceId = value1
return &out
}