summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.idl
blob: f70159c8f397b4a1c438225f8cce851c3f8a4b3c (plain)
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
#import <HTML/HTMLCanvasElement.idl>
#import <HTML/HTMLImageElement.idl>
#import <HTML/ImageData.idl>
#import <HTML/TextMetrics.idl>
#import <HTML/CanvasGradient.idl>

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 scale(double x, double y);
    undefined translate(double x, double y);
    undefined rotate(double radians);

    undefined beginPath();
    undefined closePath();
    undefined fill(optional DOMString fillRule = "nonzero");
    undefined stroke();
    undefined moveTo(double x, double y);
    undefined lineTo(double x, double y);
    undefined quadraticCurveTo(double cpx, double cpy, double x, double y);
    undefined bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);

    undefined arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean counterclockwise = false);
    undefined ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean counterclockwise = false);
    undefined rect(double x, double y, double width, double height);

    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 DOMString fillStyle;
    attribute DOMString strokeStyle;
    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);

    undefined save();
    undefined restore();
    undefined reset();
    boolean isContextLost();

    readonly attribute HTMLCanvasElement canvas;

    TextMetrics measureText(DOMString text);

    CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
    CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
    CanvasGradient createConicGradient(double startAngle, double x, double y);

    // FIXME: All these `double`s should be `unrestricted double`
    undefined transform(double a, double b, double c, double d, double e, double f);
    undefined setTransform(double a, double b, double c, double d, double e, double f);
    undefined resetTransform();

    // undefined clip(optional CanvasFillRule fillRule = "nonzero");
    // undefined clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
    // FIXME: Replace this with the two definitions above.
    undefined clip();

};