OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Note: The official spec is WIP at wiki.whatwg.org/wiki/OffscreenCanvas. | 5 // Note: The official spec is WIP at wiki.whatwg.org/wiki/OffscreenCanvas. |
6 | 6 |
7 [ | 7 [ |
8 Exposed=(Window,Worker), | 8 Exposed=(Window,Worker), |
9 RuntimeEnabled=ExperimentalCanvasFeatures, | 9 RuntimeEnabled=ExperimentalCanvasFeatures, |
10 ] interface OffscreenCanvasRenderingContext2D { | 10 ] interface OffscreenCanvasRenderingContext2D { |
11 // back-reference to the canvas | 11 // back-reference to the canvas |
12 [ImplementedAs=getOffscreenCanvas] readonly attribute OffscreenCanvas offscr
eenCanvas; | 12 [ImplementedAs=getOffscreenCanvas] readonly attribute OffscreenCanvas offscr
eenCanvas; |
13 | 13 |
14 // colors and styles | 14 // colors and styles |
15 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (de
fault black) | 15 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (de
fault black) |
16 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (defa
ult black) | 16 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (defa
ult black) |
17 CanvasGradient createLinearGradient(double x0, double y0, double x1, double
y1); | 17 CanvasGradient createLinearGradient(double x0, double y0, double x1, double
y1); |
18 [RaisesException] CanvasGradient createRadialGradient(double x0, double y0,
double r0, double x1, double y1, double r1); | 18 [RaisesException] CanvasGradient createRadialGradient(double x0, double y0,
double r0, double x1, double y1, double r1); |
19 [CallWith=ScriptState, RaisesException, Exposed=Worker] CanvasPattern? creat
ePattern(CanvasImageSource image, [TreatNullAs=NullString] DOMString repetitionT
ype); | 19 [CallWith=ExecutionContext, RaisesException, Exposed=Worker] CanvasPattern?
createPattern(CanvasImageSource image, [TreatNullAs=NullString] DOMString repeti
tionType); |
20 | 20 |
21 // CanvasRect interface | 21 // CanvasRect interface |
22 void clearRect(unrestricted double x, unrestricted double y, unrestricted do
uble width, unrestricted double height); | 22 void clearRect(unrestricted double x, unrestricted double y, unrestricted do
uble width, unrestricted double height); |
23 void fillRect(unrestricted double x, unrestricted double y, unrestricted dou
ble width, unrestricted double height); | 23 void fillRect(unrestricted double x, unrestricted double y, unrestricted dou
ble width, unrestricted double height); |
24 void strokeRect(unrestricted double x, unrestricted double y, unrestricted d
ouble width, unrestricted double height); | 24 void strokeRect(unrestricted double x, unrestricted double y, unrestricted d
ouble width, unrestricted double height); |
25 | 25 |
26 // Path API (See BaseRenderingContext2D) | 26 // Path API (See BaseRenderingContext2D) |
27 void beginPath(); | 27 void beginPath(); |
28 void fill(optional CanvasFillRule winding); | 28 void fill(optional CanvasFillRule winding); |
29 void fill(Path2D path, optional CanvasFillRule winding); | 29 void fill(Path2D path, optional CanvasFillRule winding); |
30 void stroke(); | 30 void stroke(); |
31 void stroke(Path2D path); | 31 void stroke(Path2D path); |
32 | 32 |
| 33 // drawing images |
| 34 // TODO(crbug.com/563856): Expose these API to Window with more layout tests |
| 35 [CallWith=ExecutionContext, Exposed=Worker, RaisesException] void drawImage(
CanvasImageSource image, unrestricted double x, unrestricted double y); |
| 36 [CallWith=ExecutionContext, Exposed=Worker, RaisesException] void drawImage(
CanvasImageSource image, unrestricted double x, unrestricted double y, unrestric
ted double width, unrestricted double height); |
| 37 [CallWith=ExecutionContext, Exposed=Worker, RaisesException] void drawImage(
CanvasImageSource image, unrestricted double sx, unrestricted double sy, unrestr
icted double sw, unrestricted double sh, unrestricted double dx, unrestricted do
uble dy, unrestricted double dw, unrestricted double dh); |
| 38 |
33 // Line caps/joins | 39 // Line caps/joins |
34 attribute unrestricted double lineWidth; // (default 1) | 40 attribute unrestricted double lineWidth; // (default 1) |
35 attribute DOMString lineCap; // "butt", "round", "square" (default "butt") | 41 attribute DOMString lineCap; // "butt", "round", "square" (default "butt") |
36 attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") | 42 attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") |
37 attribute unrestricted double miterLimit; // (default 10) | 43 attribute unrestricted double miterLimit; // (default 10) |
38 | 44 |
39 // dashed lines | 45 // dashed lines |
40 void setLineDash(sequence<unrestricted double> dash); | 46 void setLineDash(sequence<unrestricted double> dash); |
41 sequence<unrestricted double> getLineDash(); | 47 sequence<unrestricted double> getLineDash(); |
42 attribute unrestricted double lineDashOffset; | 48 attribute unrestricted double lineDashOffset; |
(...skipping 11 matching lines...) Expand all Loading... |
54 void resetTransform(); | 60 void resetTransform(); |
55 | 61 |
56 // shadows | 62 // shadows |
57 attribute unrestricted double shadowOffsetX; | 63 attribute unrestricted double shadowOffsetX; |
58 attribute unrestricted double shadowOffsetY; | 64 attribute unrestricted double shadowOffsetY; |
59 attribute unrestricted double shadowBlur; | 65 attribute unrestricted double shadowBlur; |
60 attribute DOMString shadowColor; | 66 attribute DOMString shadowColor; |
61 }; | 67 }; |
62 | 68 |
63 OffscreenCanvasRenderingContext2D implements CanvasPathMethods; | 69 OffscreenCanvasRenderingContext2D implements CanvasPathMethods; |
OLD | NEW |