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
|
#import <HTML/HTMLCanvasElement.idl>
#import <HTML/HTMLImageElement.idl>
#import <HTML/ImageData.idl>
#import <HTML/TextMetrics.idl>
#import <HTML/Canvas/CanvasFillStrokeStyles.idl>
#import <HTML/Canvas/CanvasPath.idl>
#import <HTML/Canvas/CanvasState.idl>
#import <HTML/Canvas/CanvasTransform.idl>
#import <HTML/Path2D.idl>
// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d
[Exposed=Window]
interface CanvasRenderingContext2D {
undefined fillRect(double x, double y, double w, double h);
undefined strokeRect(double x, double y, double w, double h);
undefined clearRect(double x, double y, double w, double h);
undefined beginPath();
// FIXME: `DOMString` should be `CanvasFillRule`
undefined fill(optional DOMString fillRule = "nonzero");
// FIXME: `DOMString` should be `CanvasFillRule`
undefined fill(Path2D path, optional DOMString fillRule = "nonzero");
undefined stroke();
undefined stroke(Path2D path);
undefined fillText(DOMString text, double x, double y, optional double maxWidth);
undefined strokeText(DOMString text, double x, double y, optional double maxWidth);
undefined drawImage((HTMLImageElement or HTMLCanvasElement) image, double dx, double dy);
undefined drawImage((HTMLImageElement or HTMLCanvasElement) image, double dx, double dy, double dw, double dh);
undefined drawImage((HTMLImageElement or HTMLCanvasElement) image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
attribute double lineWidth;
ImageData createImageData(long sw, long sh);
ImageData getImageData(long sx, long sy, long sw, long sh);
undefined putImageData(ImageData imagedata, double dx, double dy);
[ImplementedAs=canvas_for_binding] readonly attribute HTMLCanvasElement canvas;
TextMetrics measureText(DOMString text);
// undefined clip(optional CanvasFillRule fillRule = "nonzero");
// undefined clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
// FIXME: Replace this with the two definitions above.
undefined clip();
};
CanvasRenderingContext2D includes CanvasState;
CanvasRenderingContext2D includes CanvasTransform;
CanvasRenderingContext2D includes CanvasFillStrokeStyles;
CanvasRenderingContext2D includes CanvasPath;
|