OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // https://drafts.css-houdini.org/css-paint-api/#paintrenderingcontext2d |
| 6 |
| 7 [ |
| 8 Exposed=PaintWorklet, |
| 9 WillBeGarbageCollected, |
| 10 RuntimeEnabled=CSSPaintAPI, |
| 11 ] interface PaintRenderingContext2D { |
| 12 // state |
| 13 void save(); // push state on state stack |
| 14 void restore(); // pop state stack and restore state |
| 15 |
| 16 // transformations (default transform is the identity matrix) |
| 17 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute SVGMatrix currentTrans
form; |
| 18 void scale(unrestricted double x, unrestricted double y); |
| 19 void rotate(unrestricted double angle); |
| 20 void translate(unrestricted double x, unrestricted double y); |
| 21 void transform(unrestricted double a, unrestricted double b, unrestricted do
uble c, unrestricted double d, unrestricted double e, unrestricted double f); |
| 22 void setTransform(unrestricted double a, unrestricted double b, unrestricted
double c, unrestricted double d, unrestricted double e, unrestricted double f); |
| 23 void resetTransform(); |
| 24 |
| 25 // compositing |
| 26 attribute unrestricted double globalAlpha; // (default 1.0) |
| 27 attribute DOMString globalCompositeOperation; // (default source-over) |
| 28 |
| 29 // image smoothing |
| 30 attribute boolean imageSmoothingEnabled; // (default True) |
| 31 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute ImageSmoothingQuality
imageSmoothingQuality; // (default "low") |
| 32 |
| 33 // colors and styles (see also the CanvasDrawingStyles interface) |
| 34 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (de
fault black) |
| 35 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (defa
ult black) |
| 36 CanvasGradient createLinearGradient(double x0, double y0, double x1, double
y1); |
| 37 [RaisesException] CanvasGradient createRadialGradient(double x0, double y0,
double r0, double x1, double y1, double r1); |
| 38 [RaisesException] CanvasPattern? createPattern(CanvasImageSource image, [Tre
atNullAs=NullString] DOMString repetitionType); |
| 39 |
| 40 // shadows |
| 41 attribute unrestricted double shadowOffsetX; |
| 42 attribute unrestricted double shadowOffsetY; |
| 43 attribute unrestricted double shadowBlur; |
| 44 attribute DOMString shadowColor; |
| 45 |
| 46 // rects |
| 47 void clearRect(unrestricted double x, unrestricted double y, unrestricted do
uble width, unrestricted double height); |
| 48 void fillRect(unrestricted double x, unrestricted double y, unrestricted dou
ble width, unrestricted double height); |
| 49 void strokeRect(unrestricted double x, unrestricted double y, unrestricted d
ouble width, unrestricted double height); |
| 50 |
| 51 // path API (see also CanvasPathMethods) |
| 52 void beginPath(); |
| 53 void fill(optional CanvasFillRule winding); |
| 54 void fill(Path2D path, optional CanvasFillRule winding); |
| 55 void stroke(); |
| 56 void stroke(Path2D path); |
| 57 |
| 58 void clip(optional CanvasFillRule winding); |
| 59 void clip(Path2D path, optional CanvasFillRule winding); |
| 60 boolean isPointInPath(unrestricted double x, unrestricted double y, optional
CanvasFillRule winding); |
| 61 boolean isPointInPath(Path2D path, unrestricted double x, unrestricted doubl
e y, optional CanvasFillRule winding); |
| 62 boolean isPointInStroke(unrestricted double x, unrestricted double y); |
| 63 boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted dou
ble y); |
| 64 |
| 65 // drawing images |
| 66 [RaisesException] void drawImage(CanvasImageSource image, unrestricted doubl
e x, unrestricted double y); |
| 67 [RaisesException] void drawImage(CanvasImageSource image, unrestricted doubl
e x, unrestricted double y, unrestricted double width, unrestricted double heigh
t); |
| 68 [RaisesException] void drawImage(CanvasImageSource image, unrestricted doubl
e sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, un
restricted double dx, unrestricted double dy, unrestricted double dw, unrestrict
ed double dh); |
| 69 |
| 70 // FIXME: factor out to CanvasDrawingStyles |
| 71 // line caps/joins |
| 72 attribute unrestricted double lineWidth; // (default 1) |
| 73 attribute DOMString lineCap; // "butt", "round", "square" (default "butt") |
| 74 attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") |
| 75 attribute unrestricted double miterLimit; // (default 10) |
| 76 |
| 77 // dashed lines |
| 78 void setLineDash(sequence<unrestricted double> dash); |
| 79 sequence<unrestricted double> getLineDash(); |
| 80 attribute unrestricted double lineDashOffset; |
| 81 }; |
| 82 PaintRenderingContext2D implements CanvasPathMethods; |
OLD | NEW |