@@ -78,13 +78,13 @@ type rec style<_> =
78
78
| Pattern : style <pattern >
79
79
80
80
/* 2d Canvas API, following https://simon.html5.org/dump/html5-canvas-cheat-sheet.html */
81
- @send external save : t => unit = ""
82
- @send external restore : t => unit = ""
81
+ @send external save : t => unit = "save "
82
+ @send external restore : t => unit = "restore "
83
83
84
84
/* Transformation */
85
- @send external scale : (t , ~x : float , ~y : float ) => unit = ""
86
- @send external rotate : (t , float ) => unit = ""
87
- @send external translate : (t , ~x : float , ~y : float ) => unit = ""
85
+ @send external scale : (t , ~x : float , ~y : float ) => unit = "scale "
86
+ @send external rotate : (t , float ) => unit = "rotate "
87
+ @send external translate : (t , ~x : float , ~y : float ) => unit = "translate "
88
88
@send
89
89
external transform : (
90
90
t ,
@@ -94,7 +94,7 @@ external transform: (
94
94
~m22 : float ,
95
95
~dx : float ,
96
96
~dy : float ,
97
- ) => unit = ""
97
+ ) => unit = "transform "
98
98
@send
99
99
external setTransform : (
100
100
t ,
@@ -104,17 +104,17 @@ external setTransform: (
104
104
~m22 : float ,
105
105
~dx : float ,
106
106
~dy : float ,
107
- ) => unit = ""
107
+ ) => unit = "setTransform "
108
108
109
109
/* Compositing */
110
- @set external globalAlpha : (t , float ) => unit = ""
111
- @set external globalCompositeOperation : (t , Composite .t ) => unit = ""
110
+ @set external globalAlpha : (t , float ) => unit = "globalAlpha "
111
+ @set external globalCompositeOperation : (t , Composite .t ) => unit = "globalCompositeOperation "
112
112
113
113
/* Line Styles */
114
- @set external lineWidth : (t , float ) => unit = ""
115
- @set external lineCap : (t , LineCap .t ) => unit = ""
116
- @set external lineJoin : (t , LineJoin .t ) => unit = ""
117
- @set external miterLimit : (t , float ) => unit = ""
114
+ @set external lineWidth : (t , float ) => unit = "lineWidth "
115
+ @set external lineCap : (t , LineCap .t ) => unit = "lineCap "
116
+ @set external lineJoin : (t , LineJoin .t ) => unit = "lineJoin "
117
+ @set external miterLimit : (t , float ) => unit = "miterLimit "
118
118
119
119
/* Colors, Styles, and Shadows */
120
120
@set external setFillStyle : (t , @ignore style <'a >, 'a ) => unit = "fillStyle"
@@ -145,21 +145,21 @@ let reifyStyle = (type a, x: 'a): (style<a>, a) => {
145
145
)
146
146
}
147
147
148
- @get external fillStyle : t => 'a = ""
149
- @get external strokeStyle : t => 'a = ""
148
+ @get external fillStyle : t => 'a = "fillStyle "
149
+ @get external strokeStyle : t => 'a = "strokeStyle "
150
150
151
151
let fillStyle = (ctx : t ) => ctx -> fillStyle -> reifyStyle
152
152
153
153
let strokeStyle = (ctx : t ) => ctx -> strokeStyle -> reifyStyle
154
154
155
- @set external shadowOffsetX : (t , float ) => unit = ""
156
- @set external shadowOffsetY : (t , float ) => unit = ""
157
- @set external shadowBlur : (t , float ) => unit = ""
158
- @set external shadowColor : (t , string ) => unit = ""
155
+ @set external shadowOffsetX : (t , float ) => unit = "shadowOffsetX "
156
+ @set external shadowOffsetY : (t , float ) => unit = "shadowOffsetY "
157
+ @set external shadowBlur : (t , float ) => unit = "shadowBlur "
158
+ @set external shadowColor : (t , string ) => unit = "shadowColor "
159
159
160
160
/* Gradients */
161
161
@send
162
- external createLinearGradient : (t , ~x0 : float , ~y0 : float , ~x1 : float , ~y1 : float ) => gradient = ""
162
+ external createLinearGradient : (t , ~x0 : float , ~y0 : float , ~x1 : float , ~y1 : float ) => gradient = "createLinearGradient "
163
163
@send
164
164
external createRadialGradient : (
165
165
t ,
@@ -169,8 +169,8 @@ external createRadialGradient: (
169
169
~y1 : float ,
170
170
~r0 : float ,
171
171
~r1 : float ,
172
- ) => gradient = ""
173
- @send external addColorStop : (gradient , float , string ) => unit = ""
172
+ ) => gradient = "createRadialGradient "
173
+ @send external addColorStop : (gradient , float , string ) => unit = "addColorStop "
174
174
@val
175
175
external createPattern : (
176
176
t ,
@@ -182,17 +182,17 @@ external createPattern: (
182
182
| @as ("repeat-y" ) #repeatY
183
183
| @as ("no-repeat" ) #noRepeat
184
184
],
185
- ) => pattern = ""
185
+ ) => pattern = "createPattern "
186
186
187
187
/* Paths */
188
- @send external beginPath : t => unit = ""
189
- @send external closePath : t => unit = ""
190
- @send external fill : t => unit = ""
191
- @send external stroke : t => unit = ""
192
- @send external clip : t => unit = ""
193
- @send external moveTo : (t , ~x : float , ~y : float ) => unit = ""
194
- @send external lineTo : (t , ~x : float , ~y : float ) => unit = ""
195
- @send external quadraticCurveTo : (t , ~cp1x : float , ~cp1y : float , ~x : float , ~y : float ) => unit = ""
188
+ @send external beginPath : t => unit = "beginPath "
189
+ @send external closePath : t => unit = "closePath "
190
+ @send external fill : t => unit = "fill "
191
+ @send external stroke : t => unit = "stroke "
192
+ @send external clip : t => unit = "clip "
193
+ @send external moveTo : (t , ~x : float , ~y : float ) => unit = "moveTo "
194
+ @send external lineTo : (t , ~x : float , ~y : float ) => unit = "lineTo "
195
+ @send external quadraticCurveTo : (t , ~cp1x : float , ~cp1y : float , ~x : float , ~y : float ) => unit = "quadraticCurveTo "
196
196
@send
197
197
external bezierCurveTo : (
198
198
t ,
@@ -202,8 +202,8 @@ external bezierCurveTo: (
202
202
~cp2y : float ,
203
203
~x : float ,
204
204
~y : float ,
205
- ) => unit = ""
206
- @send external arcTo : (t , ~x1 : float , ~y1 : float , ~x2 : float , ~y2 : float , ~r : float ) => unit = ""
205
+ ) => unit = "bezierCurveTo "
206
+ @send external arcTo : (t , ~x1 : float , ~y1 : float , ~x2 : float , ~y2 : float , ~r : float ) => unit = "arcTo "
207
207
@send
208
208
external arc : (
209
209
t ,
@@ -213,26 +213,25 @@ external arc: (
213
213
~startAngle : float ,
214
214
~endAngle : float ,
215
215
~anticw : bool ,
216
- ) => unit = ""
217
- @send external rect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = ""
218
- @send external isPointInPath : (t , ~x : float , ~y : float ) => bool = ""
216
+ ) => unit = "arc "
217
+ @send external rect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = "rect "
218
+ @send external isPointInPath : (t , ~x : float , ~y : float ) => bool = "isPointInPath "
219
219
220
220
/* Text */
221
- @set external font : (t , string ) => unit = ""
222
- @set external textAlign : (t , string ) => unit = ""
223
- @set external textBaseline : (t , string ) => unit = ""
221
+ @set external font : (t , string ) => unit = "font "
222
+ @set external textAlign : (t , string ) => unit = "textAlign "
223
+ @set external textBaseline : (t , string ) => unit = "textBaseline "
224
224
@send
225
- external fillText : (t , string , ~x : float , ~y : float , ~maxWidth : float = ?, @ignore unit ) => unit = ""
225
+ external fillText : (t , string , ~x : float , ~y : float , ~maxWidth : float = ?, @ignore unit ) => unit = "fillText "
226
226
@send
227
- external strokeText : (t , string , ~x : float , ~y : float , ~maxWidth : float = ?, @ignore unit ) => unit =
228
- ""
229
- @send external measureText : (t , string ) => measureText = ""
230
- @get external width : measureText => float = ""
227
+ external strokeText : (t , string , ~x : float , ~y : float , ~maxWidth : float = ?, @ignore unit ) => unit = "strokeText"
228
+ @send external measureText : (t , string ) => measureText = "measureText"
229
+ @get external width : measureText => float = "width"
231
230
232
231
/* Rectangles */
233
- @send external fillRect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = ""
234
- @send external strokeRect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = ""
235
- @send external clearRect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = ""
232
+ @send external fillRect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = "fillRect "
233
+ @send external strokeRect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = "strokeRect "
234
+ @send external clearRect : (t , ~x : float , ~y : float , ~w : float , ~h : float ) => unit = "clearRect "
236
235
237
236
@send
238
237
external createImageDataCoords : (t , ~width : float , ~height : float ) => Webapi__Dom__Image .t =
@@ -242,11 +241,10 @@ external createImageDataFromImage: (t, Webapi__Dom__Image.t) => Webapi__Dom__Ima
242
241
"createImageData"
243
242
244
243
@send
245
- external getImageData : (t , ~sx : float , ~sy : float , ~sw : float , ~sh : float ) => Webapi__Dom__Image .t =
246
- ""
244
+ external getImageData : (t , ~sx : float , ~sy : float , ~sw : float , ~sh : float ) => Webapi__Dom__Image .t = "getImageData"
247
245
248
246
@send
249
- external putImageData : (t , ~imageData : Webapi__Dom__Image .t , ~dx : float , ~dy : float ) => unit = ""
247
+ external putImageData : (t , ~imageData : Webapi__Dom__Image .t , ~dx : float , ~dy : float ) => unit = "putImageData "
250
248
251
249
@send
252
250
external putImageDataWithDirtyRect : (
0 commit comments