2022-02-15 22:40:51 +03:30
|
|
|
#import <HTML/HTMLCanvasElement.idl>
|
|
|
|
#import <HTML/HTMLImageElement.idl>
|
|
|
|
#import <HTML/ImageData.idl>
|
|
|
|
#import <HTML/TextMetrics.idl>
|
|
|
|
#import <HTML/CanvasGradient.idl>
|
2022-08-11 16:10:04 +01:00
|
|
|
#import <HTML/Canvas/CanvasPath.idl>
|
2022-08-12 14:00:00 +01:00
|
|
|
#import <HTML/Canvas/CanvasState.idl>
|
2022-08-11 17:39:37 +01:00
|
|
|
#import <HTML/Path2D.idl>
|
2022-02-15 22:40:51 +03:30
|
|
|
|
2022-08-11 16:10:04 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d
|
|
|
|
[Exposed=Window]
|
2020-06-22 18:39:22 +02:00
|
|
|
interface CanvasRenderingContext2D {
|
|
|
|
|
2020-12-09 21:32:04 +00:00
|
|
|
undefined fillRect(double x, double y, double w, double h);
|
|
|
|
undefined strokeRect(double x, double y, double w, double h);
|
2021-03-15 19:40:42 +01:00
|
|
|
undefined clearRect(double x, double y, double w, double h);
|
2020-06-22 18:39:22 +02:00
|
|
|
|
2020-12-09 21:32:04 +00:00
|
|
|
undefined scale(double x, double y);
|
|
|
|
undefined translate(double x, double y);
|
|
|
|
undefined rotate(double radians);
|
2020-06-22 18:39:22 +02:00
|
|
|
|
2020-12-09 21:32:04 +00:00
|
|
|
undefined beginPath();
|
2022-08-11 17:39:37 +01:00
|
|
|
// FIXME: `DOMString` should be `CanvasFillRule`
|
2021-04-14 23:25:23 +03:00
|
|
|
undefined fill(optional DOMString fillRule = "nonzero");
|
2022-08-11 17:39:37 +01:00
|
|
|
// FIXME: `DOMString` should be `CanvasFillRule`
|
|
|
|
undefined fill(Path2D path, optional DOMString fillRule = "nonzero");
|
2020-12-09 21:32:04 +00:00
|
|
|
undefined stroke();
|
2022-08-11 17:39:37 +01:00
|
|
|
undefined stroke(Path2D path);
|
2020-06-22 18:39:22 +02:00
|
|
|
|
2021-04-15 20:36:10 +03:00
|
|
|
undefined fillText(DOMString text, double x, double y, optional double maxWidth);
|
2022-02-03 20:09:57 +01:00
|
|
|
undefined strokeText(DOMString text, double x, double y, optional double maxWidth);
|
2021-04-15 20:36:10 +03:00
|
|
|
|
2022-03-04 19:02:10 +01:00
|
|
|
undefined drawImage((HTMLImageElement or HTMLCanvasElement) image, double dx, double dy);
|
2022-03-05 20:54:22 +02:00
|
|
|
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);
|
2020-06-22 18:39:22 +02:00
|
|
|
|
|
|
|
attribute DOMString fillStyle;
|
|
|
|
attribute DOMString strokeStyle;
|
|
|
|
attribute double lineWidth;
|
|
|
|
|
2022-03-04 19:05:24 +01:00
|
|
|
ImageData createImageData(long sw, long sh);
|
2022-03-04 19:07:35 +01:00
|
|
|
ImageData getImageData(long sx, long sy, long sw, long sh);
|
2020-12-09 21:32:04 +00:00
|
|
|
undefined putImageData(ImageData imagedata, double dx, double dy);
|
2020-06-22 18:39:22 +02:00
|
|
|
|
2022-06-19 19:42:27 +01:00
|
|
|
[ImplementedAs=canvas_for_binding] readonly attribute HTMLCanvasElement canvas;
|
2020-06-22 18:39:22 +02:00
|
|
|
|
2021-12-30 22:15:38 +00:00
|
|
|
TextMetrics measureText(DOMString text);
|
2022-02-03 20:08:27 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2022-08-11 15:50:46 +01:00
|
|
|
undefined transform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
|
|
|
|
undefined setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
|
2022-04-10 18:47:01 +01:00
|
|
|
undefined resetTransform();
|
2022-04-10 18:46:04 +01:00
|
|
|
|
2022-04-10 18:48:11 +01:00
|
|
|
// undefined clip(optional CanvasFillRule fillRule = "nonzero");
|
|
|
|
// undefined clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
|
|
|
|
// FIXME: Replace this with the two definitions above.
|
|
|
|
undefined clip();
|
|
|
|
|
2020-12-09 21:26:42 +00:00
|
|
|
};
|
2022-08-11 16:10:04 +01:00
|
|
|
|
2022-08-12 14:00:00 +01:00
|
|
|
CanvasRenderingContext2D includes CanvasState;
|
2022-08-11 16:10:04 +01:00
|
|
|
CanvasRenderingContext2D includes CanvasPath;
|