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 GarbageCollected, | |
9 RuntimeEnabled=CSSPaintAPI, | |
10 ] interface PaintRenderingContext2D { | |
Justin Novosad
2016/03/17 19:03:25
How does one create one of these?
For testing, yo
ikilpatrick
2016/03/17 19:15:42
You aren't able to create one of these directly, i
| |
11 // state | |
12 void save(); // push state on state stack | |
13 void restore(); // pop state stack and restore state | |
14 | |
15 // transformations (default transform is the identity matrix) | |
16 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute SVGMatrix currentTrans form; | |
17 void scale(unrestricted double x, unrestricted double y); | |
18 void rotate(unrestricted double angle); | |
19 void translate(unrestricted double x, unrestricted double y); | |
20 void transform(unrestricted double a, unrestricted double b, unrestricted do uble c, unrestricted double d, unrestricted double e, unrestricted double f); | |
21 void setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); | |
22 void resetTransform(); | |
23 | |
24 // compositing | |
25 attribute unrestricted double globalAlpha; // (default 1.0) | |
26 attribute DOMString globalCompositeOperation; // (default source-over) | |
27 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString filter; // ( default 'none') | |
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 |