1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00
serenity/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.idl
Sam Atkins 08e6071ebb LibWeb: Extract CanvasState class from CRC2D
As with CanvasPath, this is to better match the spec IDL.
2022-08-14 11:30:40 +02:00

65 lines
2.9 KiB
Text

#import <HTML/HTMLCanvasElement.idl>
#import <HTML/HTMLImageElement.idl>
#import <HTML/ImageData.idl>
#import <HTML/TextMetrics.idl>
#import <HTML/CanvasGradient.idl>
#import <HTML/Canvas/CanvasPath.idl>
#import <HTML/Canvas/CanvasState.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 scale(double x, double y);
undefined translate(double x, double y);
undefined rotate(double radians);
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 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);
[ImplementedAs=canvas_for_binding] 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);
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);
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();
};
CanvasRenderingContext2D includes CanvasState;
CanvasRenderingContext2D includes CanvasPath;